From: Colin Ian King <colin.king@canonical.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Chuck Lever <chuck.lever@oracle.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: re: nfsd: skip some unnecessary stats in the v4 case
Date: Wed, 25 Nov 2020 14:50:51 +0000 [thread overview]
Message-ID: <de7dc4f1-cbf2-6bcd-1466-d67b418dcc5f@canonical.com> (raw)
Hi,
Static analysis on today's linux-next has found an issue with the
following commit:
commit 55ea6691d52875b921d3712f9a08db8e81e059b4
Author: J. Bruce Fields <bfields@redhat.com>
Date: Fri Nov 20 17:39:19 2020 -0500
nfsd: skip some unnecessary stats in the v4 case
The analysis is as follows:
286 /*
287 * Fill in the post_op attr for the wcc data
288 */
289 void fill_post_wcc(struct svc_fh *fhp)
290 {
291 bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
292 struct inode *inode = d_inode(fhp->fh_dentry);
1. var_decl: Declaring variable err without initializer.
293 __be32 err;
294
2. Condition fhp->fh_post_saved, taking true branch.
295 if (fhp->fh_post_saved)
296 printk("nfsd: inode locked twice during operation.\n");
297
298
3. Condition !v4, taking false branch.
4. Condition !inode->i_sb->s_export_op->fetch_iversion, taking false
branch.
299 if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
300 err = fh_getattr(fhp, &fhp->fh_post_attr);
5. Condition v4, taking true branch.
301 if (v4)
302 fhp->fh_post_change =
303 nfsd4_change_attribute(&fhp->fh_post_attr,
inode);
Uninitialized scalar variable (UNINIT)6. uninit_use: Using uninitialized
value err.
304 if (err) {
305 fhp->fh_post_saved = false;
306 /* Grab the ctime anyway - set_change_info might use
it */
307 fhp->fh_post_attr.ctime = inode->i_ctime;
308 } else
309 fhp->fh_post_saved = true;
310 }
Prior to this commit, variable err used to be always assigned by the
call to err = fh_getattr(fhp, &stat), but now it is only called on
specific conditions, so now we have this unassigned err issue.
Colin
next reply other threads:[~2020-11-25 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 14:50 Colin Ian King [this message]
2020-11-25 16:47 ` nfsd: skip some unnecessary stats in the v4 case J. Bruce Fields
2020-11-25 16:51 ` Colin Ian King
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=de7dc4f1-cbf2-6bcd-1466-d67b418dcc5f@canonical.com \
--to=colin.king@canonical.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.com \
--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