lkml.org 
[lkml]   [2004]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] check copy_from_user return value in act2000_isa_download

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@dif.dk>


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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.027 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site