diff mbox series

i40iw: Fix error handling in i40iw_manage_arp_cache()

Message ID 20200422092211.GA195357@mwanda (mailing list archive)
State Mainlined
Commit 37e31d2d26a4124506c24e95434e9baf3405a23a
Delegated to: Jason Gunthorpe
Headers show
Series i40iw: Fix error handling in i40iw_manage_arp_cache() | expand

Commit Message

Dan Carpenter April 22, 2020, 9:22 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Gunthorpe April 25, 2020, 11 p.m. UTC | #1
On Wed, Apr 22, 2020 at 12:22:11PM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>  drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c
> 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,
>  	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
Saleem, Shiraz April 27, 2020, 5:54 p.m. UTC | #2
> Subject: Re: [PATCH] i40iw: Fix error handling in i40iw_manage_arp_cache()
> 
> On Wed, Apr 22, 2020 at 12:22:11PM +0300, Dan Carpenter wrote:
> > 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")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c
> > b/drivers/infiniband/hw/i40iw/i40iw_hw.c
> > 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,
> >  	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?
> 
Yes. Not convinced i40iw_manage_arp_cache being a void is ok
but that's a separate problem which I ll review internally.

Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
Jason Gunthorpe May 4, 2020, 5:13 p.m. UTC | #3
On Wed, Apr 22, 2020 at 12:22:11PM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_hw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-rc, thanks

Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/i40iw/i40iw_hw.c b/drivers/infiniband/hw/i40iw/i40iw_hw.c
index 55a1fbf0e670..ae8b97c30665 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_hw.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_hw.c
@@ -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)