Skip to contentSkip to conversation

fs: Fix uninitialized variable uflags

PATCH In review Colin Ian King 2 participants 2 messages Feb 26, 2025 – Feb 27, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: Fix uninitialized variable uflags

The variable uflags is only being initialized in the if statement that checks if flags & MOVE_MOUNT_F_EMPTY_PATH is non-zero. Fix this by initializing uflags at the start of the system call move_mount.

Fixes b1e9423d65e3 ("fs: support getname_maybe_null() in move_mount()")
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
index 663bacefddfa..c19e919a9108 100644
@@ -4599,7 +4599,7 @@ SYSCALL_DEFINE5(move_mount,
 	struct path from_path __free(path_put) = {};
 	struct filename *to_name __free(putname) = NULL;
 	struct filename *from_name __free(putname) = NULL;
-	unsigned int lflags, uflags;
+	unsigned int lflags, uflags = 0;
 	enum mnt_tree_flags_t mflags = 0;
 	int ret = 0;
 
Signature · 1 line
2.47.2
#1 lore raw
Quoted 7 lines · Colin Ian King

The variable uflags is only being initialized in the if statement that checks if flags & MOVE_MOUNT_F_EMPTY_PATH is non-zero. Fix this by initializing uflags at the start of the system call move_mount.

Fixes b1e9423d65e3 ("fs: support getname_maybe_null() in move_mount()")

---

Thanks, Colin. I've already taken in a patch from Arnd Bergmann yesterday. So this should already be fixed.

Quoted 19 lines
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
index 663bacefddfa..c19e919a9108 100644
@@ -4599,7 +4599,7 @@ SYSCALL_DEFINE5(move_mount,
 	struct path from_path __free(path_put) = {};
 	struct filename *to_name __free(putname) = NULL;
 	struct filename *from_name __free(putname) = NULL;
-	unsigned int lflags, uflags;
+	unsigned int lflags, uflags = 0;
 	enum mnt_tree_flags_t mflags = 0;
 	int ret = 0;
 
Signature · 1 line
2.47.2