Skip to contentSkip to conversation

befs: fix sparse warning in linuxvfs.c

PATCH In review Harvey Harrison 2 participants 3 messages Feb 15, 2008 Befs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 befs: fix sparse warning in linuxvfs.c

Use link as the variable name to avoid shadowing the arg.

fs/befs/linuxvfs.c:492:8: warning: symbol 'p' shadows an earlier one fs/befs/linuxvfs.c:488:77: originally declared here

---
This should be checked in case there is a latent bug here. Should it be the arg *p getting freed, or the local var *p that was shadowing it?

 fs/befs/linuxvfs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/befs/linuxvfs.c +3 -3
index 82123ff..e8717de 100644
@@ -489,9 +489,9 @@ static void befs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
 {
 	befs_inode_info *befs_ino = BEFS_I(dentry->d_inode);
 	if (befs_ino->i_flags & BEFS_LONG_SYMLINK) {
-		char *p = nd_get_link(nd);
-		if (!IS_ERR(p))
-			kfree(p);
+		char *link = nd_get_link(nd);
+		if (!IS_ERR(link))
+			kfree(link);
 	}
 }
 
Signature · 1 line
1.5.4.1.1278.gc75be
#1 lore raw
Quoted 11 lines · On Fri, 15 Feb 2008 10:46:04 -0800 Harvey Harrison <[email protected]>…

Use link as the variable name to avoid shadowing the arg.

fs/befs/linuxvfs.c:492:8: warning: symbol 'p' shadows an earlier one fs/befs/linuxvfs.c:488:77: originally declared here

---
This should be checked in case there is a latent bug here. Should it be the arg *p getting freed, or the local var *p that was shadowing it?

The code looks OK - the name was allocated in befs_follow_link() and was saved away with nd_set_link().

Quoted 22 lines
fs/befs/linuxvfs.c +3 -3
index 82123ff..e8717de 100644
@@ -489,9 +489,9 @@ static void befs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
 {
 	befs_inode_info *befs_ino = BEFS_I(dentry->d_inode);
 	if (befs_ino->i_flags & BEFS_LONG_SYMLINK) {
-		char *p = nd_get_link(nd);
-		if (!IS_ERR(p))
-			kfree(p);
+		char *link = nd_get_link(nd);
+		if (!IS_ERR(link))
+			kfree(link);
 	}
 }
 
Signature · 1 line
1.5.4.1.1278.gc75be
#2 lore raw
Quoted 15 lines · Andrew Morton
Quoted 11 lines · On Fri, 15 Feb 2008 10:46:04 -0800 Harvey Harrison <[email protected]>…

Use link as the variable name to avoid shadowing the arg.

fs/befs/linuxvfs.c:492:8: warning: symbol 'p' shadows an earlier one fs/befs/linuxvfs.c:488:77: originally declared here

---
This should be checked in case there is a latent bug here. Should it be the arg *p getting freed, or the local var *p that was shadowing it?

Quoted 2 lines

The code looks OK - the name was allocated in befs_follow_link() and was saved away with nd_set_link().

OK, that's as far as I got as well, but don't know the area well enough to be sure, hence the caveat.

Harvey