mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li, Ming Chun" <macli@brc.ubc.ca>
To: David Rientjes <rientjes@google.com>
Cc: Vincent Li <macli@brc.ubc.ca>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] fs/proc/task_mmu.c: fix clear_refs_write() input sanity check
Date: Wed, 12 Aug 2009 16:46:15 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.1.00.0908121642300.22028@mail.selltech.ca> (raw)
In-Reply-To: <alpine.DEB.2.00.0908121522350.7135@chino.kir.corp.google.com>

On Wed, 12 Aug 2009, David Rientjes wrote:

> On Wed, 12 Aug 2009, Vincent Li wrote:
> 
> > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> > index 2079969..026b532 100644
> > --- a/fs/proc/task_mmu.c
> > +++ b/fs/proc/task_mmu.c
> > @@ -494,18 +494,17 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
> >  	char buffer[PROC_NUMBUF], *end;
> >  	struct mm_struct *mm;
> >  	struct vm_area_struct *vma;
> > -	int type;
> > +	long res;
> >  
> 
> What does `res' mean?  Why can't it just be left as `type'?

res mean the result parsed from userspace input, I can keep it as name 
'type'.

> 
> >  	memset(buffer, 0, sizeof(buffer));
> >  	if (count > sizeof(buffer) - 1)
> >  		count = sizeof(buffer) - 1;
> >  	if (copy_from_user(buffer, buf, count))
> >  		return -EFAULT;
> > -	type = simple_strtol(buffer, &end, 0);
> > -	if (type < CLEAR_REFS_ALL || type > CLEAR_REFS_MAPPED)
> > +	if (strict_strtol(strstrip(buffer), 10, &res)
> > +		return -EINVAL;
> 
> Please test your patch submissions (which would require that the above 
> actually compiles).
> 

I did get compiling error and warnings, I will resend the patch with 
varible name 'type' left and no compiling errors.


Vincent Li
Biomedical Research Center
University of British Columbia

      reply	other threads:[~2009-08-12 23:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12 22:04 Vincent Li
2009-08-12 22:24 ` David Rientjes
2009-08-12 23:46   ` Li, Ming Chun [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=alpine.DEB.1.00.0908121642300.22028@mail.selltech.ca \
    --to=macli@brc.ubc.ca \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    /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

all inboxes | Powered by JetHome®