WSL2-Linux-Kernel/net/can
Julia Lawall 16dff91804 net/can: 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:11 -07:00
..
Kconfig [CAN]: Add virtual CAN netdevice driver 2008-01-28 14:54:12 -08:00
Makefile [CAN]: Add broadcast manager (bcm) protocol 2008-01-28 14:54:11 -08:00
af_can.c can: deny filterlist access on non-CAN interfaces 2010-02-02 07:21:34 -08:00
af_can.h can: Speed up CAN frame receiption by using ml_priv 2010-01-03 21:31:03 -08:00
bcm.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
proc.c can: Speed up CAN frame receiption by using ml_priv 2010-01-03 21:31:03 -08:00
raw.c net/can: Use memdup_user 2010-05-31 00:24:11 -07:00