Skip to content

Commit ecdf295

Browse files
Eran Ben Elishalinvjw
authored andcommitted
ethtool: Fix uninitialized variable use at qsfp dump
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: a5e73bb ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support") Signed-off-by: Eran Ben Elisha <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 98c148e commit ecdf295

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

qsfp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ static void sff8636_dom_parse(const __u8 *id, struct sff_diags *sd)
671671

672672
static void sff8636_show_dom(const __u8 *id, __u32 eeprom_len)
673673
{
674-
struct sff_diags sd;
674+
struct sff_diags sd = {0};
675675
char *rx_power_string = NULL;
676676
char power_string[MAX_DESC_SIZE];
677677
int i;

sfpdiag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void sff8472_parse_eeprom(const __u8 *id, struct sff_diags *sd)
241241

242242
void sff8472_show_all(const __u8 *id)
243243
{
244-
struct sff_diags sd;
244+
struct sff_diags sd = {0};
245245
char *rx_power_string = NULL;
246246
int i;
247247

0 commit comments

Comments
 (0)