diff mbox

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

Message ID 20100604103629.GC5483@bicker (mailing list archive)
State Changes Requested
Headers show

Commit Message

Dan Carpenter June 4, 2010, 10:36 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index ef259a0..aa7a298 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -1318,8 +1318,10 @@  static ssize_t dvb_ca_en50221_io_write(struct file *file,
 
 		fragbuf[0] = connection_id;
 		fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00;
-		if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0)
+		if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) {
+			status = -EFAULT;
 			goto exit;
+		}
 
 		timeout = jiffies + HZ / 2;
 		written = 0;
@@ -1494,8 +1496,10 @@  static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf,
 
 	hdr[0] = slot;
 	hdr[1] = connection_id;
-	if ((status = copy_to_user(buf, hdr, 2)) != 0)
+	if ((status = copy_to_user(buf, hdr, 2)) != 0) {
+		status = -EFAULT;
 		goto exit;
+	}
 	status = pktlen;
 
 exit: