From: David Miller <davem@davemloft.net>
To: gustavo@embeddedor.com
Cc: michael.chan@broadcom.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] bnxt_en: Remove unnecessary unsigned integer comparison and initialize variable
Date: Sun, 07 Oct 2018 20:37:39 -0700 (PDT) [thread overview]
Message-ID: <20181007.203739.679737551060624652.davem@davemloft.net> (raw)
In-Reply-To: <20181005201209.GA16515@embeddedor.com>
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Fri, 5 Oct 2018 22:12:09 +0200
> There is no need to compare *val.vu32* with < 0 because
> such variable is of type u32 (32 bits, unsigned), making it
> impossible to hold a negative value. Fix this by removing
> such comparison.
>
> Also, initialize variable *max_val* to -1, just in case
> it is not initialized to either BNXT_MSIX_VEC_MAX or
> BNXT_MSIX_VEC_MIN_MAX before using it in a comparison
> with val.vu32 at line 159:
>
> if (val.vu32 > max_val)
>
> Addresses-Coverity-ID: 1473915 ("Unsigned compared against 0")
> Addresses-Coverity-ID: 1473920 ("Uninitialized scalar variable")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Applied.
prev parent reply other threads:[~2018-10-08 3:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-05 20:12 [PATCH net-next] bnxt_en: Remove unnecessary unsigned integer comparison and initialize variable Gustavo A. R. Silva
2018-10-08 3:37 ` David Miller [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=20181007.203739.679737551060624652.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.chan@broadcom.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;
as well as URLs for NNTP newsgroup(s).