* [PATCH] net: mscc: ocelot: fix using match before it is set
@ 2022-01-18 13:41 trix
2022-01-19 14:40 ` patchwork-bot+netdevbpf
2022-01-20 17:08 ` Vladimir Oltean
0 siblings, 2 replies; 3+ messages in thread
From: trix @ 2022-01-18 13:41 UTC (permalink / raw)
To: vladimir.oltean, claudiu.manoil, alexandre.belloni, davem, kuba,
nathan, ndesaulniers, xiaoliang.yang_1
Cc: UNGLinuxDriver, netdev, linux-kernel, llvm, Tom Rix
From: Tom Rix <trix@redhat.com>
Clang static analysis reports this issue
ocelot_flower.c:563:8: warning: 1st function call argument
is an uninitialized value
!is_zero_ether_addr(match.mask->dst)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The variable match is used before it is set. So move the
block.
Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/net/ethernet/mscc/ocelot_flower.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
index 4a0fda22d3436..949858891973d 100644
--- a/drivers/net/ethernet/mscc/ocelot_flower.c
+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
@@ -559,13 +559,6 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
return -EOPNOTSUPP;
}
- if (filter->block_id == VCAP_IS1 &&
- !is_zero_ether_addr(match.mask->dst)) {
- NL_SET_ERR_MSG_MOD(extack,
- "Key type S1_NORMAL cannot match on destination MAC");
- return -EOPNOTSUPP;
- }
-
/* The hw support mac matches only for MAC_ETYPE key,
* therefore if other matches(port, tcp flags, etc) are added
* then just bail out
@@ -580,6 +573,14 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
return -EOPNOTSUPP;
flow_rule_match_eth_addrs(rule, &match);
+
+ if (filter->block_id == VCAP_IS1 &&
+ !is_zero_ether_addr(match.mask->dst)) {
+ NL_SET_ERR_MSG_MOD(extack,
+ "Key type S1_NORMAL cannot match on destination MAC");
+ return -EOPNOTSUPP;
+ }
+
filter->key_type = OCELOT_VCAP_KEY_ETYPE;
ether_addr_copy(filter->key.etype.dmac.value,
match.key->dst);
--
2.26.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: mscc: ocelot: fix using match before it is set
2022-01-18 13:41 [PATCH] net: mscc: ocelot: fix using match before it is set trix
@ 2022-01-19 14:40 ` patchwork-bot+netdevbpf
2022-01-20 17:08 ` Vladimir Oltean
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-19 14:40 UTC (permalink / raw)
To: Tom Rix
Cc: vladimir.oltean, claudiu.manoil, alexandre.belloni, davem, kuba,
nathan, ndesaulniers, xiaoliang.yang_1, UNGLinuxDriver, netdev,
linux-kernel, llvm
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Tue, 18 Jan 2022 05:41:10 -0800 you wrote:
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis reports this issue
> ocelot_flower.c:563:8: warning: 1st function call argument
> is an uninitialized value
> !is_zero_ether_addr(match.mask->dst)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Here is the summary with links:
- net: mscc: ocelot: fix using match before it is set
https://git.kernel.org/netdev/net/c/baa59504c1cd
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: mscc: ocelot: fix using match before it is set
2022-01-18 13:41 [PATCH] net: mscc: ocelot: fix using match before it is set trix
2022-01-19 14:40 ` patchwork-bot+netdevbpf
@ 2022-01-20 17:08 ` Vladimir Oltean
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2022-01-20 17:08 UTC (permalink / raw)
To: trix
Cc: Claudiu Manoil, alexandre.belloni, davem, kuba, nathan,
ndesaulniers, Xiaoliang Yang, UNGLinuxDriver, netdev,
linux-kernel, llvm
On Tue, Jan 18, 2022 at 05:41:10AM -0800, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis reports this issue
> ocelot_flower.c:563:8: warning: 1st function call argument
> is an uninitialized value
> !is_zero_ether_addr(match.mask->dst)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The variable match is used before it is set. So move the
> block.
>
> Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
(sorry for the delay)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-20 17:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-18 13:41 [PATCH] net: mscc: ocelot: fix using match before it is set trix
2022-01-19 14:40 ` patchwork-bot+netdevbpf
2022-01-20 17:08 ` Vladimir Oltean
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).