Skip to contentSkip to conversation

net/mana: fix uninitialized scalar variable

PATCH Superseded mmaatuq 2 participants 2 messages Jun 10, 2024 – Jun 12, 2024 Network drivers

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

mmaatuq

author
#0 lore raw

PATCH v2 1/1 net/mana: fix uninitialized scalar variable

in case we didn't enter or finished the loop without getting ifname we ret shouldn't have an arbitrary value.

Coverity issue: 424690

---
v2:
Fixed typo in word "arbitrary"

---
 drivers/net/mana/mana.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mana/mana.c +1 -1
index 68c625258e..c37c4e3444 100644
@@ -715,7 +715,7 @@ mana_dev_stats_reset(struct rte_eth_dev *dev __rte_unused)
 static int
 mana_get_ifname(const struct mana_priv *priv, char (*ifname)[IF_NAMESIZE])
 {
-	int ret;
+	int ret = -ENODEV;
 	DIR *dir;
 	struct dirent *dent;
 

--
2.43.0

#1 lore raw
Quoted 7 lines · mmaatuq

in case we didn't enter or finished the loop without getting ifname we ret shouldn't have an arbitrary value.

Coverity issue: 424690

Change looks good to me,
but can you please add Fixes tag [1] and perhaps stable tag based on the fixes tag, checkpatch will generate a warning for it if required, after Fixes tag added.

Also can you please use full name, as following capitalization:
Name Surname <[email protected]>

[1]
https://doc.dpdk.org/guides/contributing/patches.html#commit-messages-body

Quoted 23 lines

---
v2:
Fixed typo in word "arbitrary"

---
 drivers/net/mana/mana.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mana/mana.c +1 -2
index 68c625258e..c37c4e3444 100644
@@ -715,7 +715,7 @@ mana_dev_stats_reset(struct rte_eth_dev *dev __rte_unused)
 static int
 mana_get_ifname(const struct mana_priv *priv, char (*ifname)[IF_NAMESIZE])
 {
-	int ret;
+	int ret = -ENODEV;
 	DIR *dir;
 	struct dirent *dent;
 
--

2.43.0