public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Souptick Joarder <jrdr.linux@gmail.com>
To: bfields@fieldses.org, chuck.lever@oracle.com
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Souptick Joarder <jrdr.linux@gmail.com>
Subject: [PATCH] nfsd: Fix kernel test robot warning
Date: Sat, 28 Nov 2020 19:20:51 +0530	[thread overview]
Message-ID: <1606571451-3655-1-git-send-email-jrdr.linux@gmail.com> (raw)

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


             reply	other threads:[~2020-11-28 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 13:50 Souptick Joarder [this message]
2020-11-28 18:41 ` [PATCH] nfsd: Fix kernel test robot warning Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1606571451-3655-1-git-send-email-jrdr.linux@gmail.com \
    --to=jrdr.linux@gmail.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox