diff mbox

isdn: return -EFAULT if copy_from_user() fails

Message ID 20101210124009.GC10623@bicker
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Dec. 10, 2010, 12:40 p.m. UTC
We should be returning -EFAULT here.

Mostly this patch is to silence a smatch warning.  The upper levels
of this driver turn all non-zero return values from isar_load_firmware()
into 1.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Dec. 11, 2010, 12:16 a.m. UTC | #1
From: Dan Carpenter <error27@gmail.com>
Date: Fri, 10 Dec 2010 15:40:09 +0300

> We should be returning -EFAULT here.
> 
> Mostly this patch is to silence a smatch warning.  The upper levels
> of this driver turn all non-zero return values from isar_load_firmware()
> into 1.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Kaiser Dec. 11, 2010, 12:41 a.m. UTC | #2
Ahem, we're printing this return value:

* Dan Carpenter <error27@gmail.com>:
> -	if ((ret = copy_from_user(&size, p, sizeof(int)))) {
             ^^^
> +	if (copy_from_user(&size, p, sizeof(int))) {
>  		printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", ret);
                                                                             ^^^
> -		return ret;
> +		return -EFAULT;

Cheers,
Nicolas Kaiser
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 11, 2010, 12:47 a.m. UTC | #3
From: Nicolas Kaiser <nikai@nikai.net>
Date: Sat, 11 Dec 2010 01:41:54 +0100

> Ahem, we're printing this return value:
> 
> * Dan Carpenter <error27@gmail.com>:
>> -	if ((ret = copy_from_user(&size, p, sizeof(int)))) {
>              ^^^
>> +	if (copy_from_user(&size, p, sizeof(int))) {
>>  		printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", ret);
>                                                                              ^^^
>> -		return ret;
>> +		return -EFAULT;

I'll fix this, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index 2e72227..9cd4829 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -212,9 +212,9 @@  isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
 	cs->debug &= ~(L1_DEB_HSCX | L1_DEB_HSCX_FIFO);
 #endif
 	
-	if ((ret = copy_from_user(&size, p, sizeof(int)))) {
+	if (copy_from_user(&size, p, sizeof(int))) {
 		printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", ret);
-		return ret;
+		return -EFAULT;
 	}
 	p += sizeof(int);
 	printk(KERN_DEBUG"isar_load_firmware size: %d\n", size);