linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/mlx5: SF, silence an uninitialized variable warning
@ 2021-11-27 14:19 Dan Carpenter
  2021-11-28  9:26 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-11-27 14:19 UTC (permalink / raw)
  To: Saeed Mahameed
  Cc: Leon Romanovsky, David S. Miller, Jakub Kicinski, Parav Pandit,
	Vu Pham, Shay Drory, Jiapeng Chong, Wan Jiabing, Eli Cohen,
	netdev, linux-rdma, kernel-janitors

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>
---
 drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c b/drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
index 252d6017387d..17aa348989cb 100644
--- 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_core_dev *dev)
 {
 	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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/mlx5: SF, silence an uninitialized variable warning
  2021-11-27 14:19 [PATCH net-next] net/mlx5: SF, silence an uninitialized variable warning Dan Carpenter
@ 2021-11-28  9:26 ` Leon Romanovsky
  2021-12-02  6:28   ` Saeed Mahameed
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2021-11-28  9:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Saeed Mahameed, David S. Miller, Jakub Kicinski, Parav Pandit,
	Vu Pham, Shay Drory, Jiapeng Chong, Wan Jiabing, Eli Cohen,
	netdev, linux-rdma, kernel-janitors

On Sat, Nov 27, 2021 at 05:19:53PM +0300, Dan Carpenter wrote:
> 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>
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net/mlx5: SF, silence an uninitialized variable warning
  2021-11-28  9:26 ` Leon Romanovsky
@ 2021-12-02  6:28   ` Saeed Mahameed
  0 siblings, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2021-12-02  6:28 UTC (permalink / raw)
  To: dan.carpenter, leon
  Cc: Shay Drory, linux-rdma, Parav Pandit, davem, kernel-janitors,
	wanjiabing, jiapeng.chong, Vu Pham, Eli Cohen, kuba, netdev

On Sun, 2021-11-28 at 11:26 +0200, Leon Romanovsky wrote:
> On Sat, Nov 27, 2021 at 05:19:53PM +0300, Dan Carpenter wrote:
> > 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>
> > ---
> >  drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

applied to net-next-mlx5.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-02  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 14:19 [PATCH net-next] net/mlx5: SF, silence an uninitialized variable warning Dan Carpenter
2021-11-28  9:26 ` Leon Romanovsky
2021-12-02  6:28   ` Saeed Mahameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).