[PATCH] check copy_from_user return value in act2000_isa_download

From: Jesper Juhl
Date: Sun Sep 19 2004 - 16:40:25 EST



Here's a patch to fix the following warning by checking the return value
of copy_from_user and returning -EFAULT if it fails.

drivers/isdn/act2000/act2000_isa.c: In function `act2000_isa_download':
drivers/isdn/act2000/act2000_isa.c:437: warning: ignoring return value of `copy_from_user', declared with attribute warn_unused_result

I don't have the hardware so I've only been able to do compile testing of
this patch.

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>


diff -up linux-2.6.9-rc2-bk5-orig/drivers/isdn/act2000/act2000_isa.c linux-2.6.9-rc2-bk5/drivers/isdn/act2000/act2000_isa.c
--- linux-2.6.9-rc2-bk5-orig/drivers/isdn/act2000/act2000_isa.c 2004-08-14 07:36:56.000000000 +0200
+++ linux-2.6.9-rc2-bk5/drivers/isdn/act2000/act2000_isa.c 2004-09-19 23:34:49.000000000 +0200
@@ -434,7 +434,10 @@ act2000_isa_download(act2000_card * card
l = (length > 1024) ? 1024 : length;
c = 0;
b = buf;
- copy_from_user(buf, p, l);
+ if (copy_from_user(buf, p, l)) {
+ kfree(buf);
+ return -EFAULT;
+ }
while (c < l) {
if (act2000_isa_writeb(card, *b++)) {
printk(KERN_WARNING


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/