Message ID | e85f9977-0719-4de8-952e-8ecdd741a9d4@paulmck-laptop (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [RFC,namespace] Fix uninitialized uflags in SYSCALL_DEFINE5(move_mount) | expand |
On Wed, Feb 26, 2025 at 11:18:49AM -0800, Paul E. McKenney wrote: > 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@kernel.org> > Cc: Alexander Viro <viro@zeniv.linux.org.uk> > Cc: Christian Brauner <brauner@kernel.org> > Cc: Jan Kara <jack@suse.cz> > Cc: <linux-fsdevel@vger.kernel.org> > Cc: <linux-kernel@vger.kernel.org> > --- Hey Paul! Thank you for the patch. The fix is correct but I've already taken a patch from Arnd yesterday. So hopefully you'll forgive me for not taking yours. :) > 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;
On Thu, Feb 27, 2025 at 09:13:10AM +0100, Christian Brauner wrote: > On Wed, Feb 26, 2025 at 11:18:49AM -0800, Paul E. McKenney wrote: > > 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@kernel.org> > > Cc: Alexander Viro <viro@zeniv.linux.org.uk> > > Cc: Christian Brauner <brauner@kernel.org> > > Cc: Jan Kara <jack@suse.cz> > > Cc: <linux-fsdevel@vger.kernel.org> > > Cc: <linux-kernel@vger.kernel.org> > > --- > > Hey Paul! Thank you for the patch. The fix is correct but I've already > taken a patch from Arnd yesterday. So hopefully you'll forgive me for > not taking yours. :) Thank you, and looking forward to seeing -next being fixed. I guess I just need to be faster. ;-) Thanx, Paul > > 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;
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;
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@kernel.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: <linux-fsdevel@vger.kernel.org> Cc: <linux-kernel@vger.kernel.org> --- namespace.c | 2 ++ 1 file changed, 2 insertions(+)