lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 6 Nov 2015 09:55:08 -0800
From:	Michael Chan <mchan@...adcom.com>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
CC:	<davem@...emloft.net>, <netdev@...r.kernel.org>,
	Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH net 4/5] bnxt_en: Fix comparison of u16 sw_id against
 negative value.

On Fri, 2015-11-06 at 14:57 +0300, Sergei Shtylyov wrote: 
> Hello.
> 
> On 11/6/2015 12:25 AM, Michael Chan wrote:
> 
> > Assign the return value from bitmap_find_free_region() to an integer
> > variable and check for negative error codes first, before assigning
> > the bit ID to the unsigned sw_id field.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Cc: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Michael Chan <mchan@...adcom.com>
> > ---
> >   drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++----
> >   1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > index a62deff..db15c5e 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > @@ -5307,7 +5307,7 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
> >   	struct bnxt_ntuple_filter *fltr, *new_fltr;
> >   	struct flow_keys *fkeys;
> >   	struct ethhdr *eth = (struct ethhdr *)skb_mac_header(skb);
> > -	int rc = 0, idx;
> > +	int rc = 0, idx, bit_id;
> 
>     I'd use the already declared 'rc' variable.
> 

I agree with you.  Normally, rc should only contain 0 or negative error
codes and is returned to the caller.  In this particular case, the
caller expects negative or non negative values and we could have used
rc.

Perhaps I'll make the change in the next round of patches.  Thanks.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ