public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base ty
Date: Wed, 26 Sep 2012 21:43:33 +0000	[thread overview]
Message-ID: <20120926214333.GP5749@moon> (raw)
In-Reply-To: <20120926155910.GA14447@localhost>

On Wed, Sep 26, 2012 at 02:17:49PM -0700, Andrew Morton wrote:
> On Thu, 27 Sep 2012 00:06:38 +0300
> Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > On Thu, Sep 27, 2012 at 12:19:34AM +0400, Cyrill Gorcunov wrote:
> > > On Wed, Sep 26, 2012 at 01:05:58PM -0700, Andrew Morton wrote:
> > > > > -	if (!access_ok(VERIFY_READ, addr, sizeof(addr)) || addr < mmap_min_addr)
> > > > > +	if (!access_ok(VERIFY_READ, (void *)addr, sizeof(addr)) || addr < mmap_min_addr)
> > > > >  		return -EINVAL;
> > > > >  
> > > > >  	error = -EINVAL;
> > > > 
> > > > It should have the __user tag as well, methinks?
> > > > 
> > > > --- a/kernel/sys.c~prctl-use-access_ok-instead-of-task_size-in-prctl_set_mm-fix-fix
> > > > +++ a/kernel/sys.c
> > > > @@ -1865,7 +1865,8 @@ static int prctl_set_mm(int opt, unsigne
> > > >  	if (opt = PR_SET_MM_EXE_FILE)
> > > >  		return prctl_set_mm_exe_file(mm, (unsigned int)addr);
> > > >  
> > > > -	if (!access_ok(VERIFY_READ, (void *)addr, sizeof(addr)) || addr < mmap_min_addr)
> > > > +	if (!access_ok(VERIFY_READ, (void __user *)addr, sizeof(addr)) ||
> > 
> > I would have expected sizeof(*addr) except addr is unsigned long.
> > To me sizeof(unsigned long) would be clearer.
> Well, we're setting a boundary here so what *is* the correct size? 
> zero?  maximum possible vm space?
> 
> I think I'll drop the patch, pending some clear thinking ;)

Well, lets stick with old well knew TASK_SIZE then, the data copying from
user-space will be checked by copy-from-user helper where needed anyway.

All this tests are rather a fast check for sane values.

[ to me sizeof(unsigned long) doesn't look anyhow cleaner, addr declared
  as long integer by a purpose so I dont get why explicit typing should
  help here ]

      parent reply	other threads:[~2012-09-26 21:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 15:59 [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base types) Fengguang Wu
2012-09-26 17:08 ` [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base ty Cyrill Gorcunov
2012-09-26 20:05 ` Andrew Morton
2012-09-26 20:19 ` Cyrill Gorcunov
2012-09-26 21:06 ` Dan Carpenter
2012-09-26 21:17 ` Andrew Morton
2012-09-26 21:43 ` Cyrill Gorcunov [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=20120926214333.GP5749@moon \
    --to=gorcunov@openvz.org \
    --cc=kernel-janitors@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