lkml.org 
[lkml]   [2009]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs/proc/task_mmu.c: fix clear_refs_write() input sanity check
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'?

> 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).


\
 
 \ /
  Last update: 2009-08-13 00:27    [W:2.240 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site