aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-04 11:39:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 14:28:59 -0400
commite252984c5279dde24fbd6d3efe7fe13dc642e714 (patch)
tree71f9dd577ee9744fddf72a6baec80eb79a1a1b10 /drivers
parentaac870a8770281c6ad619b538df77840b9513a0b (diff)
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: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index ef259a0718ac..cb97e6b85432 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -1318,8 +1318,11 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
1318 1318
1319 fragbuf[0] = connection_id; 1319 fragbuf[0] = connection_id;
1320 fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; 1320 fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00;
1321 if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) 1321 status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen);
1322 if (status) {
1323 status = -EFAULT;
1322 goto exit; 1324 goto exit;
1325 }
1323 1326
1324 timeout = jiffies + HZ / 2; 1327 timeout = jiffies + HZ / 2;
1325 written = 0; 1328 written = 0;
@@ -1494,8 +1497,11 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf,
1494 1497
1495 hdr[0] = slot; 1498 hdr[0] = slot;
1496 hdr[1] = connection_id; 1499 hdr[1] = connection_id;
1497 if ((status = copy_to_user(buf, hdr, 2)) != 0) 1500 status = copy_to_user(buf, hdr, 2);
1501 if (status) {
1502 status = -EFAULT;
1498 goto exit; 1503 goto exit;
1504 }
1499 status = pktlen; 1505 status = pktlen;
1500 1506
1501exit: 1507exit: