Skip to content

Commit

Permalink
dpaa2-switch: fix default return of dpaa2_switch_flower_parse_mirror_key
Browse files Browse the repository at this point in the history
commit 2a36ed7 upstream.

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.

Fixes: 0f3faec ("dpaa2-switch: add VLAN based mirroring")
Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
trixirt authored and gregkh committed Feb 23, 2022
1 parent 1a16f04 commit d3c9dd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c
Expand Up @@ -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) |
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d3c9dd3

Please sign in to comment.