Since 'snprintf()' returns the number of characters emitted and an overflow is impossible, an extra call to 'strlen()' in 'ovl_lookup_temp()' may be dropped. Compile tested only. To whom it still concerns, this also reduces .text a bit. Before: text data bss dec hex filename 162522 10954 22 173498 2a5ba fs/overlayfs/overlay.ko After: text data bss dec hex filename 162430 10954 22 173406 2a55e fs/overlayfs/overlay.ko Signed-off-by: Dmitry Antipov --- fs/overlayfs/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index a5e9ddf3023b..c5b2553ef6f1 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c @@ -66,9 +66,9 @@ struct dentry *ovl_lookup_temp(struct ovl_fs *ofs, struct dentry *workdir) static atomic_t temp_id = ATOMIC_INIT(0); /* counter is allowed to wrap, since temp dentries are ephemeral */ - snprintf(name, sizeof(name), "#%x", atomic_inc_return(&temp_id)); + int len = snprintf(name, sizeof(name), "#%x", atomic_inc_return(&temp_id)); - temp = ovl_lookup_upper(ofs, name, workdir, strlen(name)); + temp = ovl_lookup_upper(ofs, name, workdir, len); if (!IS_ERR(temp) && temp->d_inode) { pr_err("workdir/%s already exists\n", name); dput(temp); -- 2.51.0