From: David Miller <davem@davemloft.net>
To: vladimir.oltean@nxp.com
Cc: netdev@vger.kernel.org, yangbo.lu@nxp.com,
xiaoliang.yang_1@nxp.com, UNGLinuxDriver@microchip.com,
claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com,
andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com,
kuba@kernel.org
Subject: Re: [PATCH net] net: mscc: ocelot: return error if VCAP filter is not found
Date: Mon, 21 Sep 2020 17:31:02 -0700 (PDT) [thread overview]
Message-ID: <20200921.173102.2069908741483449991.davem@davemloft.net> (raw)
In-Reply-To: <20200921233637.152646-1-vladimir.oltean@nxp.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Date: Tue, 22 Sep 2020 02:36:37 +0300
> From: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
>
> There are 2 separate, but related, issues.
>
> First, the ocelot_vcap_block_get_filter_index function, née
> ocelot_ace_rule_get_index_id prior to the aae4e500e106 ("net: mscc:
> ocelot: generalize the "ACE/ACL" names") rename, does not do what the
> author probably intended. If the desired filter entry is not present in
> the ACL block, this function returns an index equal to the total number
> of filters, instead of -1, which is maybe what was intended, judging
> from the curious initialization with -1, and the "++index" idioms.
> Either way, none of the callers seems to expect this behavior.
>
> Second issue, the callers don't actually check the return value at all.
> So in case the filter is not found in the rule list, propagate the
> return code to avoid kernel panics.
>
> So update the callers and also take the opportunity to get rid of the
> odd coding idioms that appear to work but don't.
>
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Please repost this with an appropriate Fixes: tag.
Thank you.
next prev parent reply other threads:[~2020-09-22 0:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 23:36 [PATCH net] net: mscc: ocelot: return error if VCAP filter is not found Vladimir Oltean
2020-09-22 0:31 ` David Miller [this message]
2020-09-22 0:39 ` Vladimir Oltean
2020-09-22 0:42 ` 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=20200921.173102.2069908741483449991.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoliang.yang_1@nxp.com \
--cc=yangbo.lu@nxp.com \
/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