Skip to contentSkip to conversation

fsinfo: fix an uninialized variable 'conn'

PATCH In review Colin King 2 participants 2 messages May 14, 2020 – May 19, 2020

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 fsinfo: fix an uninialized variable 'conn'

From: Colin Ian King <[email protected]>

Variable conn is not initialized and can potentially contain garbage causing a false -EPERM return on the !conn check. Fix this by initializing it to false.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes f2494de388bd ("fsinfo: Add an attribute that lists all the visible mounts in a namespace")
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namespace.c +1 -1
index 3fd24575756b..ae489cbac467 100644
@@ -4433,7 +4433,7 @@ int fsinfo_generic_mount_all(struct path *path, struct fsinfo_context *ctx)
 	struct mnt_namespace *ns;
 	struct mount *m, *p;
 	struct path chroot;
-	bool conn;
+	bool conn = false;
 
 	m = real_mount(path->mnt);
 	ns = m->mnt_ns;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

Variable conn is not initialized and can potentially contain garbage causing a false -EPERM return on the !conn check. Fix this by initializing it to false.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes f2494de388bd ("fsinfo: Add an attribute that lists all the visible mounts in a namespace")

Thanks, I've folded that in.

David