mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Hong <lihong.hi@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	David Brownell <david-b@pacbell.net>,
	Oliver Neukum <oliver@neukum.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: use memdup_user()
Date: Mon, 4 May 2009 23:13:49 +0800	[thread overview]
Message-ID: <3a3680030905040813x3e372f64kf73e33cdab45a31b@mail.gmail.com> (raw)
In-Reply-To: <20090504145348.GA10545@kroah.com>

2009/5/4 Greg KH <greg@kroah.com>:
> On Mon, May 04, 2009 at 10:41:51AM +0300, Pekka Enberg wrote:
>> Hi!
>>
>> On Sunday 03 May 2009, Oliver Neukum wrote:
>> >> No. To make it plain. To me any use of memdup_user() in USB code
>> >> is a bad idea. I don't want to have to think about a new primitive.
>>
>> On Mon, May 4, 2009 at 10:02 AM, David Brownell <david-b@pacbell.net> wrote:
>> > Unless it's incorrect to use that, I have to say that it
>> > makes more sense to use that utility than recreate it by
>> > open-coding...
>>
>> Yup, and I don't really see how anyone can avoid "thinking about a new
>> primitive" anyway. We have it in the kernel now and surely it will
>> appear under drivers/usb/ sooner or later...
>
> Well, how about passing the GPF flags down to memdup_user() so that we
> can use it in the usb subsystem, and Oliver's complaint will be resolve?
>
> thanks,
>
> greg k-h
>

No, the debate is not here. As the comment in memdup_user() says:

        /*
         * Always use GFP_KERNEL, since copy_from_user() can sleep and
         * cause pagefault, which makes it pointless to use GFP_NOFS
         * or GFP_ATOMIC.
         */

So it is pointless to add a GFP flag to memdup_user().

I guess what Oliver insists is that the involvement of memdup_user() erases
the explicit call of kmalloc(). However, doesn't every function wrap
some details?

Regards,
Hong

  reply	other threads:[~2009-05-04 15:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-03 16:00 Li Hong
2009-05-03 16:28 ` Oliver Neukum
2009-05-03 17:09 ` Oliver Neukum
2009-05-04  3:38   ` Li Hong
2009-05-04  6:54     ` Oliver Neukum
2009-05-04  7:02       ` David Brownell
2009-05-04  7:41         ` Pekka Enberg
2009-05-04 14:53           ` Greg KH
2009-05-04 15:13             ` Li Hong [this message]
2009-05-05  8:50             ` Oliver Neukum
2009-05-04 14:01         ` Oliver Neukum
2009-05-05  6:11           ` Andrew Morton
2009-05-05 10:44             ` Oliver Neukum
2009-05-05 17:22               ` Andrew Morton
2009-05-06 13:34                 ` Oliver Neukum
2009-05-06 18:31                   ` Andrew Morton
2009-05-06 18:44                     ` Oliver Neukum

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=3a3680030905040813x3e372f64kf73e33cdab45a31b@mail.gmail.com \
    --to=lihong.hi@gmail.com \
    --cc=david-b@pacbell.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.org \
    --cc=penberg@cs.helsinki.fi \
    /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®