diff mbox

isdn: return -EFAULT if copy_from_user() fails

Message ID 20101210.165259.22054320.davem@davemloft.net
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Miller Dec. 11, 2010, 12:52 a.m. UTC
From: David Miller <davem@davemloft.net>
Date: Fri, 10 Dec 2010 16:50:03 -0800 (PST)

> From: David Miller <davem@davemloft.net>
> Date: Fri, 10 Dec 2010 16:47:21 -0800 (PST)
> 
>> 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.
> 
> As follows:

Ugh, that was buggy, let's try this :-)

--------------------
isdn: Fix printed out copy_from_user() return value after previous change.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/isdn/hisax/isar.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Comments

Dan Carpenter Dec. 11, 2010, 5:07 a.m. UTC | #1
> >>> Ahem, we're printing this return value:
> >>> 

Doh!  Thanks for that guys.

regards,
dan carpenter
--
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 c9cd4d2..d4cce33 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -189,7 +189,7 @@  ISARVersion(struct IsdnCardState *cs, char *s)
 static int
 isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
 {
-	int ret, size, cnt, debug;
+	int cfu_ret, ret, size, cnt, debug;
 	u_char len, nom, noc;
 	u_short sadr, left, *sp;
 	u_char __user *p = buf;
@@ -212,8 +212,9 @@  isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
 	cs->debug &= ~(L1_DEB_HSCX | L1_DEB_HSCX_FIFO);
 #endif
 	
-	if (copy_from_user(&size, p, sizeof(int))) {
-		printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", ret);
+	cfu_ret = copy_from_user(&size, p, sizeof(int));
+	if (cfu_ret) {
+		printk(KERN_ERR"isar_load_firmware copy_from_user ret %d\n", cfu_ret);
 		return -EFAULT;
 	}
 	p += sizeof(int);