Skip to content

Commit baa5950

Browse files
Tom Rixdavem330
authored andcommitted
net: mscc: ocelot: fix using match before it is set
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: 75944fd ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1") Signed-off-by: Tom Rix <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f1131b9 commit baa5950

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/net/ethernet/mscc/ocelot_flower.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,6 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
559559
return -EOPNOTSUPP;
560560
}
561561

562-
if (filter->block_id == VCAP_IS1 &&
563-
!is_zero_ether_addr(match.mask->dst)) {
564-
NL_SET_ERR_MSG_MOD(extack,
565-
"Key type S1_NORMAL cannot match on destination MAC");
566-
return -EOPNOTSUPP;
567-
}
568-
569562
/* The hw support mac matches only for MAC_ETYPE key,
570563
* therefore if other matches(port, tcp flags, etc) are added
571564
* then just bail out
@@ -580,6 +573,14 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
580573
return -EOPNOTSUPP;
581574

582575
flow_rule_match_eth_addrs(rule, &match);
576+
577+
if (filter->block_id == VCAP_IS1 &&
578+
!is_zero_ether_addr(match.mask->dst)) {
579+
NL_SET_ERR_MSG_MOD(extack,
580+
"Key type S1_NORMAL cannot match on destination MAC");
581+
return -EOPNOTSUPP;
582+
}
583+
583584
filter->key_type = OCELOT_VCAP_KEY_ETYPE;
584585
ether_addr_copy(filter->key.etype.dmac.value,
585586
match.key->dst);

0 commit comments

Comments
 (0)