Skip to contentSkip to conversation

net/mana: fix uninitialized scalar variable

PATCH Superseded mmaatuq 3 participants 7 messages Jun 10, 2024 – Jul 5, 2024 Network drivers

lore
Share & tools
lore

mmaatuq

author
#0 lore raw

PATCH 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 arbitray value.

Coverity issue: 424690

---
 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;
 
Signature · 1 line
2.43.0
#1 lore raw

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

From: mmaatuq <[email protected]>

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

Coverity issue: 424690

Fixes 84497839d9ca ("net/mana: support MTU update")

---
v3:
* add Fixes and Cc tags
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

Reviewed-by on v3 1/1
#2 lore raw
Quoted 7 lines

Subject: [PATCH v3] net/mana: fix uninitialized scalar variable

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

From: mmaatuq <[email protected]>

Quoted 8 lines

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

Coverity issue: 424690

Fixes 84497839d9ca ("net/mana: support MTU update")

Thank you.

#3 lore raw
In reply to Mahmoud Maatuq
Quoted 11 lines · Mahmoud Maatuq

From: mmaatuq <[email protected]>

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

Coverity issue: 424690

Fixes 84497839d9ca ("net/mana: support MTU update")

Hi Mahmoud,

According to Developer Certificate of Origin [1] that DPDK adopts [2], please use full name in the sign off.

[1]
http://developercertificate.org/

[2]
https://old.dpdk.org/dev#send

Quoted 25 lines

---
v3:
* add Fixes and Cc tags
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

#4 lore raw

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

In reply to 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

Fixes 84497839d9ca ("net/mana: support MTU update")

---
v4:
* used full name in the sign off
v3:
* add Fixes and Cc tags
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

Reviewed-by on v4 1/1
#5 lore raw
Quoted 5 lines

Subject: [PATCH v4] net/mana: fix uninitialized scalar variable

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Quoted 8 lines

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

Coverity issue: 424690

Fixes 84497839d9ca ("net/mana: support MTU update")
Quoted 25 lines

---
v4:
* used full name in the sign off
v3:
* add Fixes and Cc tags
v2:
* Fixed typo in word "arbitrary"

---
 drivers/net/mana/mana.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mana/mana.c index renamed from drivers/net/mana/mana.c +0 -0

68c625258e..c37c4e3444 100644

drivers/net/mana/mana.c +0 -0
@@ -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]) {

drivers/net/mana/mana.c +1 -2
-       int ret;
+       int ret = -ENODEV;
        DIR *dir;
        struct dirent *dent;
 
--

2.43.0

Applied
#6 lore raw
Quoted 8 lines · Long Li
Quoted 8 lines

Subject: [PATCH v4] net/mana: fix uninitialized scalar variable

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

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

Quoted 8 lines
Quoted 5 lines

Coverity issue: 424690

Fixes 84497839d9ca ("net/mana: support MTU update")

Applied to dpdk-next-net/main, thanks.