[2.6 patch] e1000e/ethtool.c: fix error checks

Previous thread: drivers/net/niu.c: possible array overflows by Adrian Bunk on Sunday, October 14, 2007 - 10:50 am. (2 messages)

Next thread: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use by Adrian Bunk on Sunday, October 14, 2007 - 10:52 am. (4 messages)
From: Adrian Bunk
Date: Sunday, October 14, 2007 - 10:51 am

You want to check for the value, not for the address.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1451,11 +1451,11 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data)
 	}
 
 	*data = e1000_setup_desc_rings(adapter);
-	if (data)
+	if (*data)
 		goto out;
 
 	*data = e1000_setup_loopback_test(adapter);
-	if (data)
+	if (*data)
 		goto err_loopback;
 
 	*data = e1000_run_loopback_test(adapter);

-

From: Kok, Auke
Date: Monday, October 15, 2007 - 9:20 am

I'll forward this to Jeff,

thanks.

Auke
-

Previous thread: drivers/net/niu.c: possible array overflows by Adrian Bunk on Sunday, October 14, 2007 - 10:50 am. (2 messages)

Next thread: [2.6 patch] __inet6_csk_dst_store(): fix check-after-use by Adrian Bunk on Sunday, October 14, 2007 - 10:52 am. (4 messages)