[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3eg9Ml/LmLR3L3C@kili>
Date: Fri, 18 Nov 2022 18:12:52 +0300
From: Dan Carpenter <error27@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
Steen Hegelund <steen.hegelund@...rochip.com>
Cc: Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Daniel Machon <daniel.machon@...rochip.com>,
UNGLinuxDriver@...rochip.com,
Casper Andersson <casper.casan@...il.com>,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] net: microchip: sparx5: fix uninitialized variables
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@...il.com>
---
drivers/net/ethernet/microchip/sparx5/sparx5_tc_flower.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
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");
--
2.35.1
Powered by blists - more mailing lists