1
0
Fork 0
alistair23-linux/drivers/isdn/pcbit
Julia Lawall 024cb8a67f drivers/isdn: Use memdup_user
Use memdup_user when user data is immediately copied into the
allocated region.

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-05-31 00:24:15 -07:00
..
Kconfig Kconfig: Remove useless and sometimes wrong comments 2009-11-09 09:40:56 +01:00
Makefile
callbacks.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
callbacks.h
capi.c Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
capi.h
drv.c drivers/isdn: Use memdup_user 2010-05-31 00:24:15 -07:00
edss1.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
edss1.h [PATCH] drivers/isdn/pcbit/: proper prototypes 2007-02-12 09:48:34 -08:00
layer2.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
layer2.h
module.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
pcbit.h [PATCH] drivers/isdn/pcbit/: proper prototypes 2007-02-12 09:48:34 -08:00