Skip to contentSkip to conversation

i40iw: Fix error handling in i40iw_manage_arp_cache()

PATCH Applied Dan Carpenter 3 participants 4 messages Apr 22, 2020 – May 4, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40iw: Fix error handling in i40iw_manage_arp_cache()

The i40iw_arp_table() function can return -EOVERFLOW if i40iw_alloc_resource() fails so we can't just test for "= -1".

Fixes 4e9042e647ff ("i40iw: add hw and utils files")
---
 drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_hw.c +1 -1
index 55a1fbf0e670..ae8b97c30665 100644
@@ -534,7 +534,7 @@ void i40iw_manage_arp_cache(struct i40iw_device *iwdev,
 	int arp_index;
 
 	arp_index = i40iw_arp_table(iwdev, ip_addr, ipv4, mac_addr, action);
-	if (arp_index = -1)
+	if (arp_index < 0)
 		return;
 	cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false);
 	if (!cqp_request)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 12 lines · Dan Carpenter

The i40iw_arp_table() function can return -EOVERFLOW if i40iw_alloc_resource() fails so we can't just test for "= -1".

Fixes 4e9042e647ff ("i40iw: add hw and utils files")
 drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_hw.c +1 -0
index 55a1fbf0e670..ae8b97c30665 100644
+++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c

drivers/infiniband/hw/i40iw/i40iw_hw.c void i40iw_manage_arp_cache(struct i40iw_device *iwdev, · line 540

Quoted 8 lines
drivers/infiniband/hw/i40iw/i40iw_hw.c +1 -1
@@ -534,7 +534,7 @@ void i40iw_manage_arp_cache(struct i40iw_device *iwdev,
 	int arp_index;
 
 	arp_index = i40iw_arp_table(iwdev, ip_addr, ipv4, mac_addr, action);
-	if (arp_index = -1)
+	if (arp_index < 0)
 		return;
 	cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false);
 	if (!cqp_request)

It is right Shiraz?

Jason

#2 lore raw
Quoted 19 lines

Subject: Re: [PATCH] i40iw: Fix error handling in i40iw_manage_arp_cache()

drivers/infiniband/hw/i40iw/i40iw_hw.c void i40iw_manage_arp_cache(struct i40iw_device

Quoted 13 lines · Dan Carpenter

The i40iw_arp_table() function can return -EOVERFLOW if i40iw_alloc_resource() fails so we can't just test for "= -1".

Fixes 4e9042e647ff ("i40iw: add hw and utils files")

drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/i40iw/i40iw_hw.c +1 -0
index 55a1fbf0e670..ae8b97c30665 100644
+++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c
@@ -534,7 +534,7 @@ void i40iw_manage_arp_cache(struct i40iw_device

*iwdev,

Quoted 2 lines
drivers/infiniband/hw/i40iw/i40iw_hw.c +0 -0
 	int arp_index;
 
Quoted 9 lines

drivers/infiniband/hw/i40iw/i40iw_hw.c void i40iw_manage_arp_cache(struct i40iw_device *iwdev, · line 540

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_hw.c +1 -1
 	arp_index = i40iw_arp_table(iwdev, ip_addr, ipv4, mac_addr, action);
-	if (arp_index = -1)
+	if (arp_index < 0)
 		return;
 	cqp_request = i40iw_get_cqp_request(&iwdev->cqp, false);
 	if (!cqp_request)

It is right Shiraz?

Yes. Not convinced i40iw_manage_arp_cache being a void is ok but that's a separate problem which I ll review internally.

#3 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

The i40iw_arp_table() function can return -EOVERFLOW if i40iw_alloc_resource() fails so we can't just test for "= -1".

Fixes 4e9042e647ff ("i40iw: add hw and utils files")
---
 drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason