From: Dan Carpenter <error27@gmail.com>
To: bjschuma@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: smatch stuff: returning signed values in nfs_negotiate_security()
Date: Mon, 28 Mar 2011 11:22:20 +0300 [thread overview]
Message-ID: <20110328082220.GH1885@bicker> (raw)
Hi Brian,
7ebb931598 "NFS: use secinfo when crossing mountpoints" has a signed vs
unsigned bug.
fs/nfs/namespace.c +189 nfs_lookup_with_sec(10)
warn: unsigned 'flavor' is never less than zero.
161 page = alloc_page(GFP_KERNEL);
162 if (!page) {
163 status = -ENOMEM;
^^^^^^^^^^^^^^^^
Btw. this gets over written after we goto out.
164 goto out;
165 }
166 flavors = page_address(page);
167 status = secinfo(parent->d_inode, &dentry->d_name, flavors);
168 flavor = nfs_find_best_sec(flavors, dentry->d_inode);
169 put_page(page);
170 }
171
172 return flavor;
173
174 out:
175 status = -ENOMEM;
^^^^^^^^^^^^^^^^
Here.
More importantly, the caller is expecting an unsigned return value. The
check for negative returns in nfs_lookup_with_sec() doesn't work.
176 return status;
regards,
dan carpenter
next reply other threads:[~2011-03-28 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 8:22 Dan Carpenter [this message]
2011-03-28 20:59 ` smatch stuff: returning signed values in nfs_negotiate_security() Bryan Schumaker
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=20110328082220.GH1885@bicker \
--to=error27@gmail.com \
--cc=bjschuma@netapp.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;
as well as URLs for NNTP newsgroup(s).