[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140602155340.0814cf04@alan.etchedpixels.co.uk>
Date: Mon, 2 Jun 2014 15:53:40 +0100
From: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
To: Fabian Frederick <fabf@...net.be>
Cc: linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
Anil Gurumurthy <anil.gurumurthy@...gic.com>,
"James E.J. Bottomley" <JBottomley@...allels.com>
Subject: Re: [RFC 1/1] drivers/scsi/bfa/bfad_debugfs.c: replace 2
kzalloc/copy_from_user to memdup_user
On Fri, 30 May 2014 19:07:36 +0200
Fabian Frederick <fabf@...net.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
--
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