[v4] net/mana: fix uninitialized scalar variable
Checks
Commit Message
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: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
---
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(-)
--
2.43.0
Comments
> Subject: [PATCH v4] 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 ]
>
> 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: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
Reviewed-by: Long Li <longli@microsoft.com>
> ---
> 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(-)
>
> 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
On 6/14/2024 6:47 AM, Long Li wrote:
>> Subject: [PATCH v4] 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 ]
>>
>> 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: Mahmoud Maatuq <mahmoudmatook.mm@gmail.com>
>
> Reviewed-by: Long Li <longli@microsoft.com>
>
Applied to dpdk-next-net/main, thanks.
@@ -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;