Julia Lawall ad96a7a7ea drivers/block: use memdup_user
Use memdup_user when user data is immediately copied into the
allocated region.  Some checkpatch cleanups in nearby code.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   <+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+>
   }
-  if (copy_from_user(to, from, size) != 0) {
-    <+... when != goto l2;
-    -EFAULT
-    ...+>
-  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Chirag Kantharia <chirag.kantharia@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2010-08-07 18:52:31 +02:00
..
2010-08-07 18:25:00 +02:00
2010-08-07 18:52:30 +02:00
2010-02-22 13:44:45 +01:00
2010-08-07 18:52:30 +02:00
2010-08-07 18:52:30 +02:00
2010-08-07 18:52:31 +02:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2010-05-11 09:02:55 +02:00
2009-10-01 21:17:49 +02:00
2010-08-07 18:25:00 +02:00
2005-04-16 15:20:36 -07:00
2009-03-26 21:15:27 +01:00
2010-08-07 18:25:00 +02:00
2008-10-21 07:48:11 -04:00