WSL2-Linux-Kernel/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
..
Makefile viafb: move some modesetting functions to a seperate file 2010-05-07 17:17:38 -06:00
accel.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
accel.h viafb: complete support for VX800/VX855 accelerated framebuffer 2010-04-20 14:23:20 -06:00
chip.h viafb: Determine type of 2D engine and store it in chip_info 2010-04-20 14:23:19 -06:00
debug.h viafb: chip.h, debug.h 2008-10-16 11:21:41 -07:00
dvi.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
dvi.h viafb: some dvi cleanup 2010-03-12 15:52:33 -08:00
global.c viafb: make some variables a bit less global 2010-03-12 15:52:33 -08:00
global.h viafb: Separate global and fb-specific data 2010-05-07 17:16:02 -06:00
hw.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
hw.h viafb: fold via_io.h into via-core.h 2010-05-11 16:06:14 -06:00
ioctl.c viafb: iface.c, iface.h, ioctl.c, ioctl.h 2008-10-16 11:21:41 -07:00
ioctl.h viafb: Add 1200x900 DCON/LCD panel modes for OLPC XO-1.5 2010-04-20 14:23:20 -06:00
lcd.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
lcd.h viafb: Add 1200x900 DCON/LCD panel modes for OLPC XO-1.5 2010-04-20 14:23:20 -06:00
lcdtbl.h viafb: lcd.c, lcd.h, lcdtbl.h 2008-10-16 11:21:41 -07:00
share.h viafb: fold via_io.h into via-core.h 2010-05-11 16:06:14 -06:00
tbl1636.c viafb: tbl1636.c, tbl1636.h, tblDPASetting.c, tblDPASetting.h 2008-10-16 11:21:41 -07:00
tbl1636.h viafb: tbl1636.c, tbl1636.h, tblDPASetting.c, tblDPASetting.h 2008-10-16 11:21:41 -07:00
tblDPASetting.c viafb: tbl1636.c, tbl1636.h, tblDPASetting.c, tblDPASetting.h 2008-10-16 11:21:41 -07:00
tblDPASetting.h viafb: tbl1636.c, tbl1636.h, tblDPASetting.c, tblDPASetting.h 2008-10-16 11:21:41 -07:00
via-core.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
via-gpio.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
via_i2c.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
via_modesetting.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
via_modesetting.h viafb: move some modesetting functions to a seperate file 2010-05-07 17:17:38 -06:00
via_utility.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
via_utility.h viafb: remove dead code 2010-03-12 15:52:33 -08:00
viafbdev.c drivers/video/via: use memdup_user 2010-05-27 09:12:42 -07:00
viafbdev.h viafb: Separate global and fb-specific data 2010-05-07 17:16:02 -06:00
viamode.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
viamode.h viafb: split global index up 2010-03-12 15:52:33 -08:00
vt1636.c viafb: move some include files to include/linux 2010-05-11 16:07:59 -06:00
vt1636.h viafb: rework the I2C support in the VIA framebuffer driver 2010-04-27 13:01:45 -06:00