lkml.org 
[lkml]   [2014]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH V3] drivers/scsi/bfa/bfad_debugfs.c: replace 2 kzalloc/copy_from_user by memdup_user
From
Date
On Mon, 2014-06-02 at 19:50 +0200, Fabian Frederick wrote:
> This patch also removes unnecessary printk(KERN_INFO
[]
> diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
[]
> @@ -260,18 +260,10 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf,
> unsigned long flags;
> void *kern_buf;
>
> - kern_buf = kzalloc(nbytes, GFP_KERNEL);
> + kern_buf = memdup_user(buf, nbytes);
>

trivial note:

There's an uncommon blank line here.

Generally this form is:

foo = memdup_user(bar, len);
if (IS_ERR(foo))

not

foo = memdup_user(bar, len);

if (IS_ERR(foo))


> @@ -336,18 +328,10 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf,
> unsigned long flags;
> void *kern_buf;
>
> - kern_buf = kzalloc(nbytes, GFP_KERNEL);
> + kern_buf = memdup_user(buf, nbytes);
>

here too.




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