dpaa2-switch: fix default return of dpaa2_switch_flower_parse_mirror_key
Subsystems (3)
PATCH 1/1 dpaa2-switch: fix default return of dpaa2_switch_flower_parse_mirror_key
From: Tom Rix <[email protected]>
Clang static analysis reports this representative problem dpaa2-switch-flower.c:616:24: warning: The right operand of '=='
is a garbage value
tmp->cfg.vlan_id == vlan) {
^ ~~~~vlan is set in dpaa2_switch_flower_parse_mirror_key(). However this function can return success without setting vlan. So change the default return to -EOPNOTSUPP.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c +3 -1
@@ -532,6 +532,7 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls,struct flow_rule *rule =flow_cls_offload_flow_rule (cls);struct flow_dissector *dissector = rule->match.dissector;struct netlink_ext_ack *extack = cls->common.extack; +int ret = -EOPNOTSUPP ; if (dissector->used_keys & ~(BIT(FLOW_DISSECTOR_KEY_BASIC) |
@@ -561,9 +562,10 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls, } *vlan = (u16 )match.key->vlan_id; + ret =0 ; } -return 0 ; +return ret; } static int
Signature · 1 line
2.26.3
Quoted 5 lines · On Mon, Feb 14, 2022 at 07:41:39AM -0800, [email protected] wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this representative problem dpaa2-switch-flower.c:616:24: warning: The right operand of '=='
is a garbage value
Quoted 8 lines
tmp->cfg.vlan_id == vlan) { ^ ~~~~vlan is set in
dpaa2_switch_flower_parse_mirror_key(). However this function can return success without setting vlan. So change the default return to-EOPNOTSUPP.Fixes 0f3faece5808 ("dpaa2-switch: add VLAN based mirroring")Signed-off-by Tom Rix <[email protected]>
Thanks!
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 5 lines · On Mon, 14 Feb 2022 07:41:39 -0800 you wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this representative problem dpaa2-switch-flower.c:616:24: warning: The right operand of '=='
is a garbage value
Quoted 7 lines
tmp->cfg.vlan_id == vlan) { ^ ~~~~vlan is set in
dpaa2_switch_flower_parse_mirror_key(). However this function can return success without setting vlan. So change the default return to-EOPNOTSUPP.[...]
Here is the summary with links:
- dpaa2-switch: fix default return of dpaa2_switch_flower_parse_mirror_key
https://git.kernel.org/netdev/net/c/2a36ed7c1cd5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html