mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Julia Lawall <julia@diku.dk>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 5/27] mm: Use memdup_user
Date: Mon, 24 May 2010 10:04:10 +0900 (JST)	[thread overview]
Message-ID: <20100524095902.1E92.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1005221019370.13021@ask.diku.dk>

> Signed-off-by: Julia Lawall <julia@diku.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@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>




      reply	other threads:[~2010-05-24  1:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-22  8:19 Julia Lawall
2010-05-24  1:04 ` KOSAKI Motohiro [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=20100524095902.1E92.A69D9226@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=julia@diku.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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

all inboxes | Powered by JetHome®