Blob Blame History Raw
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Sat, 27 Nov 2021 17:19:53 +0300
Subject: net/mlx5: SF, silence an uninitialized variable warning
Patch-mainline: v5.17-rc1
Git-commit: c64d01b3ceba873aa8e8605598cec4a6bc6d1601
References: jsc#PED-1549

This code sometimes calls mlx5_sf_hw_table_hwc_init() when "ext_base_id"
is uninitialized.  It's not used on that path, but it generates a static
checker warning to pass uninitialized variables to another function.
It may also generate runtime UBSan  warnings depending on if the
mlx5_sf_hw_table_hwc_init() function is inlined or not.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
@@ -247,7 +247,7 @@ int mlx5_sf_hw_table_init(struct mlx5_co
 {
 	struct mlx5_sf_hw_table *table;
 	u16 max_ext_fn = 0;
-	u16 ext_base_id;
+	u16 ext_base_id = 0;
 	u16 max_fn = 0;
 	u16 base_id;
 	int err;