Message ID | Y3eg9Ml/LmLR3L3C@kili (mailing list archive) |
---|---|
State | Accepted |
Commit | 4e9a61394dc47d651690f4f87398ac5944e02678 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: microchip: sparx5: fix uninitialized variables | expand |
Hello: This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <kuba@kernel.org>: On Fri, 18 Nov 2022 18:12:52 +0300 you wrote: > Smatch complains that "err" can be uninitialized on these paths. Also > it's just nicer to "return 0;" instead of "return err;" > > Fixes: 3a344f99bb55 ("net: microchip: sparx5: Add support for TC flower ARP dissector") > Signed-off-by: Dan Carpenter <error27@gmail.com> > --- > drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) Here is the summary with links: - [net-next] net: microchip: sparx5: fix uninitialized variables https://git.kernel.org/netdev/net-next/c/4e9a61394dc4 You are awesome, thank you!
diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c index a48baeacc1d2..aab7507cf568 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c @@ -341,7 +341,7 @@ sparx5_tc_flower_handler_vlan_usage(struct sparx5_tc_flower_parse_usage *st) st->used_keys |= BIT(FLOW_DISSECTOR_KEY_VLAN); - return err; + return 0; out: NL_SET_ERR_MSG_MOD(st->fco->common.extack, "vlan parse error"); return err; @@ -452,8 +452,10 @@ sparx5_tc_flower_handler_arp_usage(struct sparx5_tc_flower_parse_usage *st) /* The IS2 ARP keyset does not support ARP hardware addresses */ if (!is_zero_ether_addr(mt.mask->sha) || - !is_zero_ether_addr(mt.mask->tha)) + !is_zero_ether_addr(mt.mask->tha)) { + err = -EINVAL; goto out; + } if (mt.mask->sip) { ipval = be32_to_cpu((__force __be32)mt.key->sip); @@ -477,7 +479,7 @@ sparx5_tc_flower_handler_arp_usage(struct sparx5_tc_flower_parse_usage *st) st->used_keys |= BIT(FLOW_DISSECTOR_KEY_ARP); - return err; + return 0; out: NL_SET_ERR_MSG_MOD(st->fco->common.extack, "arp parse error");
Smatch complains that "err" can be uninitialized on these paths. Also it's just nicer to "return 0;" instead of "return err;" Fixes: 3a344f99bb55 ("net: microchip: sparx5: Add support for TC flower ARP dissector") Signed-off-by: Dan Carpenter <error27@gmail.com> --- drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)