public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Hariprasad Shenai <hariprasad@chelsio.com>
To: Andrzej Hajda <a.hajda@samsung.com>
Cc: "open list:CXGB4 ETHERNET DRIVER (CXGB4)"
	<netdev@vger.kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cxgb4: fix invalid checks in alloc_uld_rxqs
Date: Tue, 23 Aug 2016 13:38:59 +0530	[thread overview]
Message-ID: <20160823080858.GA23111@hari-Latitude-E5550> (raw)
In-Reply-To: <56a89d7c-3a0b-d270-99c9-1632320c6339@samsung.com>

On Tuesday, August 08/23/16, 2016 at 10:01:59 +0200, Andrzej Hajda wrote:
> On 08/23/2016 09:46 AM, Hariprasad Shenai wrote:
> > On Tuesday, August 08/23/16, 2016 at 08:16:19 +0200, Andrzej Hajda wrote:
> >> Local variable msi_idx defined as unsigned int is always >= 0, thus both
> >> 'if' checks are always true. On the other side presence of USING_MSIX flag
> >> suggests the checks should not be trivially true.
> >> The simplest solution is to replace incorrect checks with direct testing
> >> of adap->flags and remove spare variables.
> >>
> >> The problem has been detected using semantic patch
> >> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
> >>
> > The correct fix is to have local variable 'msi_idx' as int instead of unsigned
> > int. Thanks for reporting the issue. Do you want me to send a V2?
> >
> > Thanks,
> > Hari
> >
> >
> If adap->flags is constant during the call I see no point in creating
> separate
> 
> variable with complicated initialization used only for the same thing as
> 
> 'adap->flags & USING_MSIX', and even if adap->flags changes during the call
> 
> much simpler would be to use local var:
> 
>     int using_msix = adap->flags & USING_MSIX;
> 
> and later use tests:
> 
>     if (using_msix)
> 
>         ...
> 
> Am I correct?
Yes, you are correct.

      reply	other threads:[~2016-08-23  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  6:16 [PATCH] cxgb4: fix invalid checks in alloc_uld_rxqs Andrzej Hajda
2016-08-23  7:46 ` Hariprasad Shenai
2016-08-23  8:01   ` Andrzej Hajda
2016-08-23  8:08     ` Hariprasad Shenai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160823080858.GA23111@hari-Latitude-E5550 \
    --to=hariprasad@chelsio.com \
    --cc=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox