[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211006140259.12689-1-tim.gardner@canonical.com>
Date: Wed, 6 Oct 2021 08:02:59 -0600
From: Tim Gardner <tim.gardner@...onical.com>
To: aelior@...vell.com
Cc: tim.gardner@...onical.com, GR-everest-linux-l2@...vell.com,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Shai Malin <smalin@...vell.com>,
Omkar Kulkarni <okulkarni@...vell.com>,
Prabhakar Kushwaha <pkushwaha@...vell.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next][RFC] qed: Initialize debug string array
Coverity complains of an uninitialized variable.
CID 120847 (#1 of 1): Uninitialized scalar variable (UNINIT)
3. uninit_use_in_call: Using uninitialized value *sw_platform_str when calling qed_dump_str_param. [show details]
1344 offset += qed_dump_str_param(dump_buf + offset,
1345 dump, "sw-platform", sw_platform_str);
Fix this by initializing the string array with '\0'.
Fixes: 6c95dd8f0aa1d ("qed: Update debug related changes")
Cc: Ariel Elior <aelior@...vell.com>
Cc: GR-everest-linux-l2@...vell.com
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Jakub Kicinski <kuba@...nel.org>
Cc: Shai Malin <smalin@...vell.com>
Cc: Omkar Kulkarni <okulkarni@...vell.com>
Cc: Prabhakar Kushwaha <pkushwaha@...vell.com>
Cc: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org (open list)
Signed-off-by: Tim Gardner <tim.gardner@...onical.com>
---
I'm not sure what the value of sw_platform_str should be, but this patch is
clearly a bandaid and not a proper solution.
---
drivers/net/ethernet/qlogic/qed/qed_debug.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
index 6d693ee380f1..a393b786c5dc 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
@@ -1319,6 +1319,8 @@ static u32 qed_dump_common_global_params(struct qed_hwfn *p_hwfn,
u32 offset = 0;
u8 num_params;
+ sw_platform_str[0] = '\0';
+
/* Dump global params section header */
num_params = NUM_COMMON_GLOBAL_PARAMS + num_specific_global_params +
(dev_data->chip_id == CHIP_BB ? 1 : 0);
--
2.33.0
Powered by blists - more mailing lists