From: Jarod Wilson Date: Fri, 16 Jul 2010 21:29:54 +0000 (-0300) Subject: V4L/DVB: IR/lirc: use memdup_user instead of copy_from_user X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6efb870a115ac223ab578bc76699ba8591250568;p=openwrt%2Fstaging%2Fblogic.git V4L/DVB: IR/lirc: use memdup_user instead of copy_from_user Signed-off-by: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index afb1ada36c78..ee1f2d443ab2 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c @@ -74,14 +74,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, if (count > LIRCBUF_SIZE || count % 2 == 0) return -EINVAL; - txbuf = kzalloc(sizeof(int) * LIRCBUF_SIZE, GFP_KERNEL); - if (!txbuf) - return -ENOMEM; - - if (copy_from_user(txbuf, buf, n)) { - ret = -EFAULT; - goto out; - } + txbuf = memdup_user(buf, n); + if (IS_ERR(txbuf)) + return PTR_ERR(txbuf); ir_dev = lirc->ir_dev; if (!ir_dev) {