* smatch stuff: returning signed values in nfs_negotiate_security()
@ 2011-03-28 8:22 Dan Carpenter
2011-03-28 20:59 ` Bryan Schumaker
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-03-28 8:22 UTC (permalink / raw)
To: bjschuma; +Cc: linux-nfs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: smatch stuff: returning signed values in nfs_negotiate_security()
2011-03-28 8:22 smatch stuff: returning signed values in nfs_negotiate_security() Dan Carpenter
@ 2011-03-28 20:59 ` Bryan Schumaker
0 siblings, 0 replies; 2+ messages in thread
From: Bryan Schumaker @ 2011-03-28 20:59 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-nfs
On 03/28/2011 04:22 AM, Dan Carpenter wrote:
> Hi Brian,
>
> 7ebb931598 "NFS: use secinfo when crossing mountpoints" has a signed vs
> unsigned bug.
Thanks for pointing this out. I'll fix this up.
-Bryan
>
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-28 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 8:22 smatch stuff: returning signed values in nfs_negotiate_security() Dan Carpenter
2011-03-28 20:59 ` Bryan Schumaker
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).