LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] befs: fix sparse warning in linuxvfs.c
@ 2008-02-15 18:46 Harvey Harrison
  2008-02-15 21:19 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Harvey Harrison @ 2008-02-15 18:46 UTC (permalink / raw)
  To: Sergey S. Kostyliov, Andrew Morton; +Cc: LKML

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

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
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(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 82123ff..e8717de 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -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);
 	}
 }
 
-- 
1.5.4.1.1278.gc75be




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] befs: fix sparse warning in linuxvfs.c
  2008-02-15 18:46 [PATCH] befs: fix sparse warning in linuxvfs.c Harvey Harrison
@ 2008-02-15 21:19 ` Andrew Morton
  2008-02-15 21:23   ` Harvey Harrison
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2008-02-15 21:19 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: rathamahata, linux-kernel

On Fri, 15 Feb 2008 10:46:04 -0800
Harvey Harrison <harvey.harrison@gmail.com> wrote:

> 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
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
> 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().

> 
> diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
> index 82123ff..e8717de 100644
> --- a/fs/befs/linuxvfs.c
> +++ b/fs/befs/linuxvfs.c
> @@ -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);
>  	}
>  }
>  
> -- 
> 1.5.4.1.1278.gc75be
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] befs: fix sparse warning in linuxvfs.c
  2008-02-15 21:19 ` Andrew Morton
@ 2008-02-15 21:23   ` Harvey Harrison
  0 siblings, 0 replies; 3+ messages in thread
From: Harvey Harrison @ 2008-02-15 21:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: rathamahata, linux-kernel

On Fri, 2008-02-15 at 13:19 -0800, Andrew Morton wrote:
> On Fri, 15 Feb 2008 10:46:04 -0800
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
> 
> > 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
> > 
> > Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> > ---
> > 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().

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-15 21:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 18:46 [PATCH] befs: fix sparse warning in linuxvfs.c Harvey Harrison
2008-02-15 21:19 ` Andrew Morton
2008-02-15 21:23   ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).