提交 6efb870a 编写于 作者: J Jarod Wilson 提交者: Mauro Carvalho Chehab

V4L/DVB: IR/lirc: use memdup_user instead of copy_from_user

Signed-off-by: NJarod Wilson <jarod@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 5690085e
...@@ -74,14 +74,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, ...@@ -74,14 +74,9 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf,
if (count > LIRCBUF_SIZE || count % 2 == 0) if (count > LIRCBUF_SIZE || count % 2 == 0)
return -EINVAL; return -EINVAL;
txbuf = kzalloc(sizeof(int) * LIRCBUF_SIZE, GFP_KERNEL); txbuf = memdup_user(buf, n);
if (!txbuf) if (IS_ERR(txbuf))
return -ENOMEM; return PTR_ERR(txbuf);
if (copy_from_user(txbuf, buf, n)) {
ret = -EFAULT;
goto out;
}
ir_dev = lirc->ir_dev; ir_dev = lirc->ir_dev;
if (!ir_dev) { if (!ir_dev) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册