All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Schumaker <bjschuma@netapp.com>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: smatch stuff: returning signed values in nfs_negotiate_security()
Date: Mon, 28 Mar 2011 16:59:55 -0400	[thread overview]
Message-ID: <4D90F6CB.4060407@netapp.com> (raw)
In-Reply-To: <20110328082220.GH1885@bicker>

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


      reply	other threads:[~2011-03-28 20:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28  8:22 smatch stuff: returning signed values in nfs_negotiate_security() Dan Carpenter
2011-03-28 20:59 ` Bryan Schumaker [this message]

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=4D90F6CB.4060407@netapp.com \
    --to=bjschuma@netapp.com \
    --cc=error27@gmail.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 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.