lkml.org 
[lkml]   [2014]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@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


\
 
 \ /
  Last update: 2014-06-02 17:41    [W:0.065 / U:1.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site