author Eran Ben Elisha 2018-10-02 10:24:19 +0300 committer John W. Linville 2018-10-04 15:02:21 -0400 commit ecdf2952521c8e37bb608bb61384be95bceb68cd (patch) tree 67f0321651b8493af4bb0ffa9c7a2f83f9e64239 parent 98c148e8651b01561a8fb1ad8201c1d4a6c30d64 (diff) download ethtool-ecdf2952521c8e37bb608bb61384be95bceb68cd.tar.gz 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: a5e73bb05ee4 ("ethtool:QSFP Plus/QSFP28 Diagnostics Information Support") Signed-off-by: Eran Ben Elisha Reviewed-by: Andrew Lunn Signed-off-by: John W. Linville Diffstat -rw-r--r-- qsfp.c 2 -rw-r--r-- sfpdiag.c 2 2 files changed, 2 insertions, 2 deletions diff --git a/qsfp.c b/qsfp.c index 32e195d..d196aa1 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 32e4cd8..fa41651 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;