All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfsd: work around a gcc-5.1 warning
@ 2015-05-12 21:31 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-05-12 21:31 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, linux-arm-kernel, linux-kernel

gcc-5.0 warns about a potential uninitialized variable use in nfsd:

fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
   reset_union_bmap_deny(old_deny_bmap, stp);
   ^
fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
  unsigned char old_deny_bmap;
                ^

This is a false positive, the code path that is warned about cannot
actually be reached.

This adds an initialization for the variable to make the warning go
away.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This warning shows up in some ARM defconfig builds, which we try to
build with no warnings to detect regressions.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 38f2d7abe3a7..997eda362a75 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3770,6 +3770,8 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
 		set_deny(open->op_share_deny, stp);
 		fp->fi_share_deny |=
 				(open->op_share_deny & NFS4_SHARE_DENY_BOTH);
+	} else {
+		old_deny_bmap = 0;
 	}
 	spin_unlock(&fp->fi_lock);
 


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

* [PATCH] nfsd: work around a gcc-5.1 warning
@ 2015-05-12 21:31 ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-05-12 21:31 UTC (permalink / raw)
  To: linux-arm-kernel

gcc-5.0 warns about a potential uninitialized variable use in nfsd:

fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
   reset_union_bmap_deny(old_deny_bmap, stp);
   ^
fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
  unsigned char old_deny_bmap;
                ^

This is a false positive, the code path that is warned about cannot
actually be reached.

This adds an initialization for the variable to make the warning go
away.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This warning shows up in some ARM defconfig builds, which we try to
build with no warnings to detect regressions.

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 38f2d7abe3a7..997eda362a75 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3770,6 +3770,8 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
 		set_deny(open->op_share_deny, stp);
 		fp->fi_share_deny |=
 				(open->op_share_deny & NFS4_SHARE_DENY_BOTH);
+	} else {
+		old_deny_bmap = 0;
 	}
 	spin_unlock(&fp->fi_lock);
 

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

* Re: [PATCH] nfsd: work around a gcc-5.1 warning
  2015-05-12 21:31 ` Arnd Bergmann
@ 2015-05-13 18:11   ` J. Bruce Fields
  -1 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2015-05-13 18:11 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-nfs, linux-arm-kernel, linux-kernel

On Tue, May 12, 2015 at 11:31:29PM +0200, Arnd Bergmann wrote:
> gcc-5.0 warns about a potential uninitialized variable use in nfsd:
> 
> fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
> fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    reset_union_bmap_deny(old_deny_bmap, stp);
>    ^
> fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
>   unsigned char old_deny_bmap;
>                 ^
> 
> This is a false positive, the code path that is warned about cannot
> actually be reached.
> 
> This adds an initialization for the variable to make the warning go
> away.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This warning shows up in some ARM defconfig builds, which we try to
> build with no warnings to detect regressions.

OK, I guess.  How about simplifying slightly and doing it this way?--b

commit 3ae81ac291ec
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 12 23:31:29 2015 +0200

    nfsd: work around a gcc-5.1 warning
    
    gcc-5.0 warns about a potential uninitialized variable use in nfsd:
    
    fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
    fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
       reset_union_bmap_deny(old_deny_bmap, stp);
       ^
    fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
      unsigned char old_deny_bmap;
                    ^
    
    This is a false positive, the code path that is warned about cannot
    actually be reached.
    
    This adds an initialization for the variable to make the warning go
    away.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 86f5c273c9ec..aef7c9bb6114 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3861,7 +3861,7 @@ static __be32
 nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open)
 {
 	__be32 status;
-	unsigned char old_deny_bmap;
+	unsigned char old_deny_bmap = stp->st_deny_bmap;
 
 	if (!test_access(open->op_share_access, stp))
 		return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open);
@@ -3870,7 +3870,6 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
 	spin_lock(&fp->fi_lock);
 	status = nfs4_file_check_deny(fp, open->op_share_deny);
 	if (status == nfs_ok) {
-		old_deny_bmap = stp->st_deny_bmap;
 		set_deny(open->op_share_deny, stp);
 		fp->fi_share_deny |=
 				(open->op_share_deny & NFS4_SHARE_DENY_BOTH);

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

* [PATCH] nfsd: work around a gcc-5.1 warning
@ 2015-05-13 18:11   ` J. Bruce Fields
  0 siblings, 0 replies; 6+ messages in thread
From: J. Bruce Fields @ 2015-05-13 18:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, May 12, 2015 at 11:31:29PM +0200, Arnd Bergmann wrote:
> gcc-5.0 warns about a potential uninitialized variable use in nfsd:
> 
> fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
> fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
>    reset_union_bmap_deny(old_deny_bmap, stp);
>    ^
> fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
>   unsigned char old_deny_bmap;
>                 ^
> 
> This is a false positive, the code path that is warned about cannot
> actually be reached.
> 
> This adds an initialization for the variable to make the warning go
> away.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> This warning shows up in some ARM defconfig builds, which we try to
> build with no warnings to detect regressions.

OK, I guess.  How about simplifying slightly and doing it this way?--b

commit 3ae81ac291ec
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue May 12 23:31:29 2015 +0200

    nfsd: work around a gcc-5.1 warning
    
    gcc-5.0 warns about a potential uninitialized variable use in nfsd:
    
    fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
    fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
       reset_union_bmap_deny(old_deny_bmap, stp);
       ^
    fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
      unsigned char old_deny_bmap;
                    ^
    
    This is a false positive, the code path that is warned about cannot
    actually be reached.
    
    This adds an initialization for the variable to make the warning go
    away.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 86f5c273c9ec..aef7c9bb6114 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3861,7 +3861,7 @@ static __be32
 nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *cur_fh, struct nfs4_ol_stateid *stp, struct nfsd4_open *open)
 {
 	__be32 status;
-	unsigned char old_deny_bmap;
+	unsigned char old_deny_bmap = stp->st_deny_bmap;
 
 	if (!test_access(open->op_share_access, stp))
 		return nfs4_get_vfs_file(rqstp, fp, cur_fh, stp, open);
@@ -3870,7 +3870,6 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
 	spin_lock(&fp->fi_lock);
 	status = nfs4_file_check_deny(fp, open->op_share_deny);
 	if (status == nfs_ok) {
-		old_deny_bmap = stp->st_deny_bmap;
 		set_deny(open->op_share_deny, stp);
 		fp->fi_share_deny |=
 				(open->op_share_deny & NFS4_SHARE_DENY_BOTH);

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

* Re: [PATCH] nfsd: work around a gcc-5.1 warning
  2015-05-13 18:11   ` J. Bruce Fields
@ 2015-05-13 18:59     ` Arnd Bergmann
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-05-13 18:59 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: J. Bruce Fields, linux-nfs, linux-kernel

On Wednesday 13 May 2015 14:11:43 J. Bruce Fields wrote:
> 
> OK, I guess.  How about simplifying slightly and doing it this way?--b
> 
> commit 3ae81ac291ec
> Author: Arnd Bergmann <arnd@arndb.de>
> Date:   Tue May 12 23:31:29 2015 +0200
> 
>     nfsd: work around a gcc-5.1 warning
>     
>     gcc-5.0 warns about a potential uninitialized variable use in nfsd:
>     
>     fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
>     fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
>        reset_union_bmap_deny(old_deny_bmap, stp);
>        ^
>     fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
>       unsigned char old_deny_bmap;
>                     ^
>     
>     This is a false positive, the code path that is warned about cannot
>     actually be reached.
>     
>     This adds an initialization for the variable to make the warning go
>     away.
>     
>     Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> 

Works for me, thanks!

	Arnd

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

* [PATCH] nfsd: work around a gcc-5.1 warning
@ 2015-05-13 18:59     ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-05-13 18:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 13 May 2015 14:11:43 J. Bruce Fields wrote:
> 
> OK, I guess.  How about simplifying slightly and doing it this way?--b
> 
> commit 3ae81ac291ec
> Author: Arnd Bergmann <arnd@arndb.de>
> Date:   Tue May 12 23:31:29 2015 +0200
> 
>     nfsd: work around a gcc-5.1 warning
>     
>     gcc-5.0 warns about a potential uninitialized variable use in nfsd:
>     
>     fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
>     fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
>        reset_union_bmap_deny(old_deny_bmap, stp);
>        ^
>     fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
>       unsigned char old_deny_bmap;
>                     ^
>     
>     This is a false positive, the code path that is warned about cannot
>     actually be reached.
>     
>     This adds an initialization for the variable to make the warning go
>     away.
>     
>     Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> 

Works for me, thanks!

	Arnd

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

end of thread, other threads:[~2015-05-13 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-12 21:31 [PATCH] nfsd: work around a gcc-5.1 warning Arnd Bergmann
2015-05-12 21:31 ` Arnd Bergmann
2015-05-13 18:11 ` J. Bruce Fields
2015-05-13 18:11   ` J. Bruce Fields
2015-05-13 18:59   ` Arnd Bergmann
2015-05-13 18:59     ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.