From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Colin King <colin.king@canonical.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Antoine Tenart <antoine.tenart@bootlin.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] net: mvpp2: cls: fix less than zero check on a u32 variable
Date: Mon, 6 May 2019 09:42:00 +0200 [thread overview]
Message-ID: <20190506094200.580ddaf2@bootlin.com> (raw)
In-Reply-To: <20190505213814.4220-1-colin.king@canonical.com>
Hi Colin,
On Sun, 5 May 2019 22:38:14 +0100
Colin King <colin.king@canonical.com> wrote:
>From: Colin Ian King <colin.king@canonical.com>
>
>The signed return from the call to mvpp2_cls_c2_port_flow_index is being
>assigned to the u32 variable c2.index and then checked for a negative
>error condition which is always going to be false. Fix this by assigning
>the return to the int variable index and checking this instead.
>
>Addresses-Coverity: ("Unsigned compared against 0")
>Fixes: 90b509b39ac9 ("net: mvpp2: cls: Add Classification offload support")
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
>---
> drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
>index 4989fb13244f..c10bc257f571 100644
>--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
>+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
>@@ -1029,12 +1029,14 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port,
> struct flow_action_entry *act;
> struct mvpp2_cls_c2_entry c2;
> u8 qh, ql, pmap;
>+ int index;
>
> memset(&c2, 0, sizeof(c2));
>
>- c2.index = mvpp2_cls_c2_port_flow_index(port, rule->loc);
>- if (c2.index < 0)
>+ index = mvpp2_cls_c2_port_flow_index(port, rule->loc);
>+ if (index < 0)
> return -EINVAL;
>+ c2.index = index;
>
> act = &rule->flow->action.entries[0];
>
Thanks for the fix, my bad.
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
next prev parent reply other threads:[~2019-05-06 7:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-05 21:38 [PATCH][next] net: mvpp2: cls: fix less than zero check on a u32 variable Colin King
2019-05-06 7:42 ` Maxime Chevallier [this message]
2019-05-07 19:15 ` David Miller
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=20190506094200.580ddaf2@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=antoine.tenart@bootlin.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).