[PATCH RFC namespace] Fix uninitialized uflags in SYSCALL_DEFINE5(move_mount)

From: Paul E. McKenney
Date: Wed Feb 26 2025 - 14:19:00 EST


The next-20250226 release gets an uninitialized-variable warning from the
move_mount syscall in builds with clang 19.1.5. This variable is in fact
assigned only if the MOVE_MOUNT_F_EMPTY_PATH flag is set, but is then
unconditionally passed to getname_maybe_null(), which unconditionally
references it.

This patch simply sets uflags to zero in the same manner as is done
for lflags, which makes rcutorture happy, but might or might not be a
proper patch.

Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: <linux-fsdevel@xxxxxxxxxxxxxxx>
Cc: <linux-kernel@xxxxxxxxxxxxxxx>
---
namespace.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/namespace.c b/fs/namespace.c
index 663bacefddfa6..80505d533cd23 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4617,6 +4617,7 @@ SYSCALL_DEFINE5(move_mount,
if (flags & MOVE_MOUNT_BENEATH) mflags |= MNT_TREE_BENEATH;

lflags = 0;
+ uflags = 0;
if (flags & MOVE_MOUNT_F_SYMLINKS) lflags |= LOOKUP_FOLLOW;
if (flags & MOVE_MOUNT_F_AUTOMOUNTS) lflags |= LOOKUP_AUTOMOUNT;
if (flags & MOVE_MOUNT_F_EMPTY_PATH) uflags = AT_EMPTY_PATH;
@@ -4625,6 +4626,7 @@ SYSCALL_DEFINE5(move_mount,
return PTR_ERR(from_name);

lflags = 0;
+ uflags = 0;
if (flags & MOVE_MOUNT_T_SYMLINKS) lflags |= LOOKUP_FOLLOW;
if (flags & MOVE_MOUNT_T_AUTOMOUNTS) lflags |= LOOKUP_AUTOMOUNT;
if (flags & MOVE_MOUNT_T_EMPTY_PATH) uflags = AT_EMPTY_PATH;