[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100524095902.1E92.A69D9226@jp.fujitsu.com>
Date: Mon, 24 May 2010 10:04:10 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Julia Lawall <julia@...u.dk>
Cc: kosaki.motohiro@...fujitsu.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 5/27] mm: Use memdup_user
> Signed-off-by: Julia Lawall <julia@...u.dk>
>
> ---
> mm/util.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/mm/util.c b/mm/util.c
> index f5712e8..4735ea4 100644
> --- a/mm/util.c
> +++ b/mm/util.c
> @@ -225,15 +225,10 @@ char *strndup_user(const char __user *s, long n)
> if (length > n)
> return ERR_PTR(-EINVAL);
>
> - p = kmalloc(length, GFP_KERNEL);
> + p = memdup_user(s, length);
memdup? Why can't we use strnlen_user() and legitimate length copy?
>
> - if (!p)
> - return ERR_PTR(-ENOMEM);
> -
> - if (copy_from_user(p, s, length)) {
> - kfree(p);
> - return ERR_PTR(-EFAULT);
> - }
> + if (IS_ERR(p))
> + return p;
>
> p[length - 1] = '\0';
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists