[v3] net/mana: fix uninitialized scalar variable

Message ID 20240612182332.804748-1-mahmoudmatook.mm@gmail.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers
Series [v3] net/mana: fix uninitialized scalar variable |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Mahmoud Matook June 12, 2024, 6:23 p.m. UTC
  From: mmaatuq <mahmoudmatook.mm@gmail.com>

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")
Cc: longli@microsoft.com

Signed-off-by: mmaatuq <mahmoudmatook.mm@gmail.com>
---
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(-)

--
2.43.0
  

Comments

Long Li June 12, 2024, 11:39 p.m. UTC | #1
> Subject: [PATCH v3] net/mana: fix uninitialized scalar variable
> 
> [You don't often get email from mahmoudmatook.mm@gmail.com. Learn why
> this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> From: mmaatuq <mahmoudmatook.mm@gmail.com>
> 
> 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")
> Cc: longli@microsoft.com
> 
> Signed-off-by: mmaatuq <mahmoudmatook.mm@gmail.com>

Thank you.

Reviewed-by: Long Li <longli@microsoft.com>
  
Ferruh Yigit June 13, 2024, 1:44 p.m. UTC | #2
On 6/12/2024 7:23 PM, Mahmoud Maatuq wrote:
> From: mmaatuq <mahmoudmatook.mm@gmail.com>
> 
> 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")
> Cc: longli@microsoft.com
> 
> Signed-off-by: mmaatuq <mahmoudmatook.mm@gmail.com>
>

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


> ---
> 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(-)
> 
> diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
> index 68c625258e..c37c4e3444 100644
> --- a/drivers/net/mana/mana.c
> +++ b/drivers/net/mana/mana.c
> @@ -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
>
  

Patch

diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 68c625258e..c37c4e3444 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -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;