Skip to content
Unverified Commit 99b6a1de authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Christian Brauner
Browse files

fs: namespace: fix uninitialized variable use



clang correctly notices that the 'uflags' variable initialization
only happens in some cases:

fs/namespace.c:4622:6: error: variable 'uflags' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
 4622 |         if (flags & MOVE_MOUNT_F_EMPTY_PATH)    uflags = AT_EMPTY_PATH;
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/namespace.c:4623:48: note: uninitialized use occurs here
 4623 |         from_name = getname_maybe_null(from_pathname, uflags);
      |                                                       ^~~~~~
fs/namespace.c:4622:2: note: remove the 'if' if its condition is always true
 4622 |         if (flags & MOVE_MOUNT_F_EMPTY_PATH)    uflags = AT_EMPTY_PATH;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: b1e9423d65e3 ("fs: support getname_maybe_null() in move_mount()")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250226081201.1876195-1-arnd@kernel.org


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent f8b6cd66
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment