提交 e252984c 编写于 作者: D Dan Carpenter 提交者: Mauro Carvalho Chehab

V4L/DVB: dvb_ca_en50221: return -EFAULT on copy_to_user errors

copy_to_user() returns the number of bytes remaining to be copied which
isn't the right thing to return here.  The comments say that these
functions in dvb_ca_en50221.c should return the number of bytes copied or
an error return.  I've changed it to return -EFAULT.
Signed-off-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 aac870a8
...@@ -1318,8 +1318,11 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, ...@@ -1318,8 +1318,11 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
fragbuf[0] = connection_id; fragbuf[0] = connection_id;
fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00;
if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen);
if (status) {
status = -EFAULT;
goto exit; goto exit;
}
timeout = jiffies + HZ / 2; timeout = jiffies + HZ / 2;
written = 0; written = 0;
...@@ -1494,8 +1497,11 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, ...@@ -1494,8 +1497,11 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf,
hdr[0] = slot; hdr[0] = slot;
hdr[1] = connection_id; hdr[1] = connection_id;
if ((status = copy_to_user(buf, hdr, 2)) != 0) status = copy_to_user(buf, hdr, 2);
if (status) {
status = -EFAULT;
goto exit; goto exit;
}
status = pktlen; status = pktlen;
exit: exit:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册