[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200921.173102.2069908741483449991.davem@davemloft.net>
Date: Mon, 21 Sep 2020 17:31:02 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: vladimir.oltean@....com
Cc: netdev@...r.kernel.org, yangbo.lu@....com,
xiaoliang.yang_1@....com, UNGLinuxDriver@...rochip.com,
claudiu.manoil@....com, alexandre.belloni@...tlin.com,
andrew@...n.ch, vivien.didelot@...il.com, f.fainelli@...il.com,
kuba@...nel.org
Subject: Re: [PATCH net] net: mscc: ocelot: return error if VCAP filter is
not found
From: Vladimir Oltean <vladimir.oltean@....com>
Date: Tue, 22 Sep 2020 02:36:37 +0300
> From: Xiaoliang Yang <xiaoliang.yang_1@....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@....com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Please repost this with an appropriate Fixes: tag.
Thank you.
Powered by blists - more mailing lists