* [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump
@ 2018-10-02 7:24 Eran Ben Elisha
2018-10-02 12:50 ` Andrew Lunn
2018-10-04 19:40 ` John W. Linville
0 siblings, 2 replies; 3+ messages in thread
From: Eran Ben Elisha @ 2018-10-02 7:24 UTC (permalink / raw)
To: netdev, John W. Linville
Cc: Chris Preimesberger, Andrew Lunn, Neil Horman,
Vidya Sagar Ravipati, Eran Ben Elisha
Struct sff_diags can be used uninitialized at sff8636_show_dom, this
caused the tool to show unreported fields (supports_alarms) by the lower
level driver.
In addition, make sure the same struct is being initialized at
sff8472_parse_eeprom function, to avoid the same issue here.
Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
---
qsfp.c | 2 +-
sfpdiag.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/qsfp.c b/qsfp.c
index 32e195d12dc0..d196aa1753de 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -671,7 +671,7 @@ static void sff8636_dom_parse(const __u8 *id, struct sff_diags *sd)
static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
{
- struct sff_diags sd;
+ struct sff_diags sd = {0};
char *rx_power_string = NULL;
char power_string[MAX_DESC_SIZE];
int i;
diff --git a/sfpdiag.c b/sfpdiag.c
index 32e4cd8917a4..fa41651422ea 100644
--- a/sfpdiag.c
+++ b/sfpdiag.c
@@ -241,7 +241,7 @@ static void sff8472_parse_eeprom(const __u8 *id, struct sff_diags *sd)
void sff8472_show_all(const __u8 *id)
{
- struct sff_diags sd;
+ struct sff_diags sd = {0};
char *rx_power_string = NULL;
int i;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump
2018-10-02 7:24 [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump Eran Ben Elisha
@ 2018-10-02 12:50 ` Andrew Lunn
2018-10-04 19:40 ` John W. Linville
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2018-10-02 12:50 UTC (permalink / raw)
To: Eran Ben Elisha
Cc: netdev, John W. Linville, Chris Preimesberger, Neil Horman,
Vidya Sagar Ravipati
On Tue, Oct 02, 2018 at 10:24:19AM +0300, Eran Ben Elisha wrote:
> Struct sff_diags can be used uninitialized at sff8636_show_dom, this
> caused the tool to show unreported fields (supports_alarms) by the lower
> level driver.
>
> In addition, make sure the same struct is being initialized at
> sff8472_parse_eeprom function, to avoid the same issue here.
>
> Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
> Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Hi Eran
Thanks for fixing both cases.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump
2018-10-02 7:24 [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump Eran Ben Elisha
2018-10-02 12:50 ` Andrew Lunn
@ 2018-10-04 19:40 ` John W. Linville
1 sibling, 0 replies; 3+ messages in thread
From: John W. Linville @ 2018-10-04 19:40 UTC (permalink / raw)
To: Eran Ben Elisha
Cc: netdev, Chris Preimesberger, Andrew Lunn, Neil Horman,
Vidya Sagar Ravipati
On Tue, Oct 02, 2018 at 10:24:19AM +0300, Eran Ben Elisha wrote:
> Struct sff_diags can be used uninitialized at sff8636_show_dom, this
> caused the tool to show unreported fields (supports_alarms) by the lower
> level driver.
>
> In addition, make sure the same struct is being initialized at
> sff8472_parse_eeprom function, to avoid the same issue here.
>
> Fixes: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support")
> Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
OK, queued for next release...
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-05 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-02 7:24 [PATCH ethtool v2] ethtool: Fix uninitialized variable use at qsfp dump Eran Ben Elisha
2018-10-02 12:50 ` Andrew Lunn
2018-10-04 19:40 ` John W. Linville
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).