LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH][next][RFC] qed: Initialize debug string array
@ 2021-10-06 14:02 Tim Gardner
2021-10-07 5:11 ` [EXT] " Prabhakar Kushwaha
0 siblings, 1 reply; 4+ messages in thread
From: Tim Gardner @ 2021-10-06 14:02 UTC (permalink / raw)
To: aelior
Cc: tim.gardner, GR-everest-linux-l2, David S. Miller,
Jakub Kicinski, Shai Malin, Omkar Kulkarni, Prabhakar Kushwaha,
netdev, linux-kernel
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@marvell.com>
Cc: GR-everest-linux-l2@marvell.com
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shai Malin <smalin@marvell.com>
Cc: Omkar Kulkarni <okulkarni@marvell.com>
Cc: Prabhakar Kushwaha <pkushwaha@marvell.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org (open list)
Signed-off-by: Tim Gardner <tim.gardner@canonical.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [EXT] [PATCH][next][RFC] qed: Initialize debug string array
2021-10-06 14:02 [PATCH][next][RFC] qed: Initialize debug string array Tim Gardner
@ 2021-10-07 5:11 ` Prabhakar Kushwaha
2021-10-07 12:04 ` [PATCH v2][next] " Tim Gardner
0 siblings, 1 reply; 4+ messages in thread
From: Prabhakar Kushwaha @ 2021-10-07 5:11 UTC (permalink / raw)
To: Tim Gardner, Ariel Elior
Cc: GR-everest-linux-l2, David S. Miller, Jakub Kicinski, Shai Malin,
Omkar Kulkarni, netdev, linux-kernel
Hi Tim,
> -----Original Message-----
> From: Tim Gardner <tim.gardner@canonical.com>
> Sent: Wednesday, October 6, 2021 7:33 PM
> To: Ariel Elior <aelior@marvell.com>
> Cc: tim.gardner@canonical.com; GR-everest-linux-l2 <GR-everest-linux-
> l2@marvell.com>; David S. Miller <davem@davemloft.net>; Jakub Kicinski
> <kuba@kernel.org>; Shai Malin <smalin@marvell.com>; Omkar Kulkarni
> <okulkarni@marvell.com>; Prabhakar Kushwaha <pkushwaha@marvell.com>;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [EXT] [PATCH][next][RFC] qed: Initialize debug string array
>
> External Email
>
> ----------------------------------------------------------------------
> 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@marvell.com>
> Cc: GR-everest-linux-l2@marvell.com
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Shai Malin <smalin@marvell.com>
> Cc: Omkar Kulkarni <okulkarni@marvell.com>
> Cc: Prabhakar Kushwaha <pkushwaha@marvell.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org (open list)
> Signed-off-by: Tim Gardner <tim.gardner@canonical.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';
> +
Thanks for pointing out. It is leftover code which I missed to remove.
Proper solution will be below. Please let me know if you are planning to send this fix else I will post.
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
index 6d693ee380f1..f6198b9a1b02 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
@@ -1315,7 +1315,6 @@ static u32 qed_dump_common_global_params(struct qed_hwfn *p_hwfn,
u8 num_specific_global_params)
{
struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
- char sw_platform_str[MAX_SW_PLTAFORM_STR_SIZE];
u32 offset = 0;
u8 num_params;
@@ -1341,8 +1340,6 @@ static u32 qed_dump_common_global_params(struct qed_hwfn *p_hwfn,
dump,
"platform",
s_hw_type_defs[dev_data->hw_type].name);
- offset += qed_dump_str_param(dump_buf + offset,
- dump, "sw-platform", sw_platform_str);
offset += qed_dump_num_param(dump_buf + offset,
dump, "pci-func", p_hwfn->abs_pf_id);
offset += qed_dump_num_param(dump_buf + offset,
--pk
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2][next] qed: Initialize debug string array
2021-10-07 5:11 ` [EXT] " Prabhakar Kushwaha
@ 2021-10-07 12:04 ` Tim Gardner
2021-10-08 14:20 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 4+ messages in thread
From: Tim Gardner @ 2021-10-07 12:04 UTC (permalink / raw)
To: pkushwaha
Cc: tim.gardner, Ariel Elior, GR-everest-linux-l2, David S. Miller,
Jakub Kicinski, Shai Malin, Omkar Kulkarni, netdev, linux-kernel
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 removing dead code that references sw_platform_str.
Fixes: 6c95dd8f0aa1d ("qed: Update debug related changes")
Cc: Ariel Elior <aelior@marvell.com>
Cc: GR-everest-linux-l2@marvell.com
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Shai Malin <smalin@marvell.com>
Cc: Omkar Kulkarni <okulkarni@marvell.com>
Cc: Prabhakar Kushwaha <pkushwaha@marvell.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org (open list)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
v2 - Arrive at the propoer fix per Prabhakar's suggestion.
---
drivers/net/ethernet/qlogic/qed/qed_debug.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
index 6d693ee380f1..f6198b9a1b02 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
@@ -1315,7 +1315,6 @@ static u32 qed_dump_common_global_params(struct qed_hwfn *p_hwfn,
u8 num_specific_global_params)
{
struct dbg_tools_data *dev_data = &p_hwfn->dbg_info;
- char sw_platform_str[MAX_SW_PLTAFORM_STR_SIZE];
u32 offset = 0;
u8 num_params;
@@ -1341,8 +1340,6 @@ static u32 qed_dump_common_global_params(struct qed_hwfn *p_hwfn,
dump,
"platform",
s_hw_type_defs[dev_data->hw_type].name);
- offset += qed_dump_str_param(dump_buf + offset,
- dump, "sw-platform", sw_platform_str);
offset += qed_dump_num_param(dump_buf + offset,
dump, "pci-func", p_hwfn->abs_pf_id);
offset += qed_dump_num_param(dump_buf + offset,
--
2.33.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2][next] qed: Initialize debug string array
2021-10-07 12:04 ` [PATCH v2][next] " Tim Gardner
@ 2021-10-08 14:20 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-08 14:20 UTC (permalink / raw)
To: Tim Gardner
Cc: pkushwaha, aelior, GR-everest-linux-l2, davem, kuba, smalin,
okulkarni, netdev, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 7 Oct 2021 06:04:13 -0600 you wrote:
> 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);
>
> [...]
Here is the summary with links:
- [v2,next] qed: Initialize debug string array
https://git.kernel.org/netdev/net-next/c/d5ac07dfbd2b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-08 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 14:02 [PATCH][next][RFC] qed: Initialize debug string array Tim Gardner
2021-10-07 5:11 ` [EXT] " Prabhakar Kushwaha
2021-10-07 12:04 ` [PATCH v2][next] " Tim Gardner
2021-10-08 14:20 ` patchwork-bot+netdevbpf
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).