kernel-ark/drivers/video/via
Julia Lawall a51faabc66 drivers/video/via: 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>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Scott Fang <ScottFang@viatech.com.cn>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27 09:12:42 -07:00
..
accel.c
accel.h
chip.h
debug.h
dvi.c
dvi.h
global.c
global.h
hw.c
hw.h
ioctl.c
ioctl.h
lcd.c
lcd.h
lcdtbl.h
Makefile
share.h
tbl1636.c
tbl1636.h
tblDPASetting.c
tblDPASetting.h
via_i2c.c
via_modesetting.c
via_modesetting.h
via_utility.c
via_utility.h
via-core.c
via-gpio.c
viafbdev.c
viafbdev.h
viamode.c
viamode.h
vt1636.c
vt1636.h