mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	Anil Gurumurthy <anil.gurumurthy@qlogic.com>,
	"James E.J. Bottomley" <JBottomley@parallels.com>
Subject: Re: [RFC 1/1] drivers/scsi/bfa/bfad_debugfs.c: replace 2 kzalloc/copy_from_user to memdup_user
Date: Mon, 2 Jun 2014 15:53:40 +0100	[thread overview]
Message-ID: <20140602155340.0814cf04@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1401469656-10332-1-git-send-email-fabf@skynet.be>

On Fri, 30 May 2014 19:07:36 +0200
Fabian Frederick <fabf@skynet.be> wrote:

> (memdup_user can be used to replace kmalloc/copy_from_user. Not sure if it's ok with kzalloc ...)


> +	kern_buf = memdup_user((void __user *)buf, nbytes);

> +	if (IS_ERR(kern_buf)) {
> +		printk(KERN_INFO "bfad[%d]: Failed to copy buffer\n",
> +		       bfad->inst_no);

While you are tidying up lose the printk KERN_INFO stuff here, it really
isn't needed.

Looks good to me and it also fixes the incorrect return of -ENOMEM the
old code had on a copy_from_user failing.

Alan

      reply	other threads:[~2014-06-02 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 17:07 Fabian Frederick
2014-06-02 14:53 ` One Thousand Gnomes [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=20140602155340.0814cf04@alan.etchedpixels.co.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=JBottomley@parallels.com \
    --cc=anil.gurumurthy@qlogic.com \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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®