mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amerigo Wang <xiyou.wangcong@gmail.com>
To: Vincent Li <macli@brc.ubc.ca>
Cc: Amerigo Wang <xiyou.wangcong@gmail.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH] fs/proc/task_mmu.c v1: fix clear_refs_write() input sanity check
Date: Thu, 13 Aug 2009 16:45:57 +0800	[thread overview]
Message-ID: <20090813084557.GB5663@cr0.nay.redhat.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0908122143060.22452@mail.selltech.ca>

On Wed, Aug 12, 2009 at 10:20:28PM -0700, Vincent Li wrote:
>On Thu, 13 Aug 2009, Amerigo Wang wrote:
>
>> On Wed, Aug 12, 2009 at 04:29:54PM -0700, Vincent Li wrote:
>> >v1 fix the compiling errors and keep the type variable name.
>> >
>> >Andrew Morton pointed out similar string hacking and obfuscated check for zero-length input
>> >at the end of the function, David Rientjes suggested to use strict_strtol to replace
>> >simple_strtol, this patch cover above suggestions, add removing of leading and trailing
>> >whitespace from user input. It does not change function behavious.
>> >
>> 
>> 
>> Sorry, what real benefits can we get from this patch?
>
>It removes the redundant and weird zero-length check at the end of the 
>function since the the function already check the returning value of 
>simple_strtol, if it is zero-length input, the function should already 
>return error -EINVAL. Also using strict_strtol would only accept ascii 
>numbers, not something like:
>>echo 1foo > /proc/pid/clear_refs
>

IIRC, many /proc files can accept input like this...

I sent a patch some time ago to "fix" this, but Andrew pointed out
that things like "1foo" can be hackish. :-/


>
>> 
>> If this is really necessary, why not other files similar to 'clear_refs'?
>> 
>
>I did the same to other functions, but Andrew pointed out making changes 
>without fully understanding the patch impact would be risky and break 
>existing applications, So I need to fully understand what those functions 
>do before I make any changes.
> 


I can't find any strong reason why this one is differernt from others
in accepting input like "1foo"...


  reply	other threads:[~2009-08-13  8:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12 23:29 Vincent Li
2009-08-13  2:09 ` Amerigo Wang
2009-08-13  5:20   ` Vincent Li
2009-08-13  8:45     ` Amerigo Wang [this message]
2009-08-13 20:12       ` David Rientjes
2009-08-13  8:36 ` David Rientjes

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=20090813084557.GB5663@cr0.nay.redhat.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macli@brc.ubc.ca \
    --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®