]> git.karo-electronics.de Git - linux-beck.git/commit
[media] ngene: properly handle __user ptr
authorMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 3 Sep 2014 23:44:04 +0000 (20:44 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Mon, 8 Sep 2014 13:00:52 +0000 (10:00 -0300)
commit04da2daee383391954b34e7d0fe0281d75447d61
treebd5e08c06fb73f2fda5f4199b00b91ecefc8d9d4
parentce9e1ac1b9becb9481f8492d9ccf713398a07ef8
[media] ngene: properly handle __user ptr

Sparse is complaining about ngene's bad usage of a __user ptr:

>> drivers/media/pci/ngene/ngene-dvb.c:62:48: sparse: incorrect type in argument 2 (different address spaces)
   drivers/media/pci/ngene/ngene-dvb.c:62:48:    expected unsigned char const [usertype] *buf
   drivers/media/pci/ngene/ngene-dvb.c:62:48:    got char const [noderef] <asn:1>*buf

As this is intercepting a .write() file ops, we can't just memcpy. We need to use
copy_from_user.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/dvb-core/dvb_ringbuffer.c
drivers/media/dvb-core/dvb_ringbuffer.h
drivers/media/pci/ngene/ngene-dvb.c