Skip to contentSkip to conversation

mlxsw: spectrum_buffers: silence uninitialized warning

PATCH Applied Dan Carpenter 3 participants 3 messages Oct 6, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlxsw: spectrum_buffers: silence uninitialized warning

Static checkers and runtime checkers such as KMSan will complain that we do not initialize the last 6 bytes of "cb_priv". The caller only uses the first two bytes so it doesn't cause a runtime issue. Still worth fixing though.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_buffers.c +1 -1
index 9de160e740b2..d78cf5a7220a 100644
@@ -1583,7 +1583,7 @@ int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core,
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_core_driver_priv(mlxsw_core);
 	struct mlxsw_sp_sb_sr_occ_query_cb_ctx cb_ctx;
-	unsigned long cb_priv;
+	unsigned long cb_priv = 0;
 	LIST_HEAD(bulk_list);
 	char *sbsr_pl;
 	u8 masked_count;
Signature · 1 line
2.20.1
#2 lore raw
In reply to Dan Carpenter
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Wed, 6 Oct 2021 10:33:47 +0300 you wrote:

Static checkers and runtime checkers such as KMSan will complain that we do not initialize the last 6 bytes of "cb_priv". The caller only uses the first two bytes so it doesn't cause a runtime issue. Still worth fixing though.

[...]

Here is the summary with links:
- [net-next] mlxsw: spectrum_buffers: silence uninitialized warning

    https://git.kernel.org/netdev/net-next/c/9b139a38016f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html