* [PATCH] nfsd: Fix kernel test robot warning
@ 2020-11-28 13:50 Souptick Joarder
2020-11-28 18:41 ` Chuck Lever
0 siblings, 1 reply; 2+ messages in thread
From: Souptick Joarder @ 2020-11-28 13:50 UTC (permalink / raw)
To: bfields, chuck.lever; +Cc: linux-nfs, linux-kernel, Souptick Joarder
Kernel test robot throws below warning -
>> fs/nfsd/nfs3xdr.c:299:6: warning: variable 'err' is used
>> uninitialized whenever 'if' condition is false
>> [-Wsometimes-uninitialized]
if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nfsd/nfs3xdr.c:304:6: note: uninitialized use occurs here
if (err) {
^~~
fs/nfsd/nfs3xdr.c:299:2: note: remove the 'if' if its condition is
always true
if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nfsd/nfs3xdr.c:293:12: note: initialize the variable 'err' to
silence this warning
__be32 err;
^
= 0
1 warning generated.
Initialize err = 0 to silence this warning.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
fs/nfsd/nfs3xdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index abb1608..47aeaee 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -290,7 +290,7 @@ void fill_post_wcc(struct svc_fh *fhp)
{
bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
struct inode *inode = d_inode(fhp->fh_dentry);
- __be32 err;
+ __be32 err = 0;
if (fhp->fh_post_saved)
printk("nfsd: inode locked twice during operation.\n");
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nfsd: Fix kernel test robot warning
2020-11-28 13:50 [PATCH] nfsd: Fix kernel test robot warning Souptick Joarder
@ 2020-11-28 18:41 ` Chuck Lever
0 siblings, 0 replies; 2+ messages in thread
From: Chuck Lever @ 2020-11-28 18:41 UTC (permalink / raw)
To: Souptick Joarder; +Cc: Bruce Fields, Linux NFS Mailing List, linux-kernel
Hello Souptick-
This looks like the same error that Coverity caught earlier this
week. AFAIK Bruce intends to address this issue with a replacement
patch:
https://lore.kernel.org/linux-nfs/20201125164738.GA7049@fieldses.org/
> On Nov 28, 2020, at 8:50 AM, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> Kernel test robot throws below warning -
>
>>> fs/nfsd/nfs3xdr.c:299:6: warning: variable 'err' is used
>>> uninitialized whenever 'if' condition is false
>>> [-Wsometimes-uninitialized]
> if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/nfsd/nfs3xdr.c:304:6: note: uninitialized use occurs here
> if (err) {
> ^~~
> fs/nfsd/nfs3xdr.c:299:2: note: remove the 'if' if its condition is
> always true
> if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/nfsd/nfs3xdr.c:293:12: note: initialize the variable 'err' to
> silence this warning
> __be32 err;
> ^
> = 0
> 1 warning generated.
>
> Initialize err = 0 to silence this warning.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
> fs/nfsd/nfs3xdr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
> index abb1608..47aeaee 100644
> --- a/fs/nfsd/nfs3xdr.c
> +++ b/fs/nfsd/nfs3xdr.c
> @@ -290,7 +290,7 @@ void fill_post_wcc(struct svc_fh *fhp)
> {
> bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
> struct inode *inode = d_inode(fhp->fh_dentry);
> - __be32 err;
> + __be32 err = 0;
>
> if (fhp->fh_post_saved)
> printk("nfsd: inode locked twice during operation.\n");
> --
> 1.9.1
>
--
Chuck Lever
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-28 22:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 13:50 [PATCH] nfsd: Fix kernel test robot warning Souptick Joarder
2020-11-28 18:41 ` Chuck Lever
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.