wifi: rtl818x: initialize eeprom_93cx6 struct to zero
Subsystems (2)
PATCH 1/1 wifi: rtl818x: initialize eeprom_93cx6 struct to zero
From: Stanislaw Gruszka <[email protected]>
Commit 7738a7ab9d12 ("misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle") added extra 'quirk' field to struct eeprom_93cx6.
Many existing users of eeprom_93cx6, including rtl818x drivers, allocate the structure on the stack without initializing all fields. As a result, the added quirk field has an undefined value and can randomly cause reading wrong data from the EEPROM.
Fix by initializing the structures with {}.
--- drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c | 2 +- drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c +1 -1
@@ -1652,7 +1652,7 @@ static void rtl8180_eeprom_register_write(struct eeprom_93cx6 *eeprom)static void rtl8180_eeprom_read (struct rtl8180_priv *priv) { -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};int eeprom_cck_table_adr;u16 eeprom_val;int i;
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +1 -1
@@ -1445,7 +1445,7 @@ static int rtl8187_probe(struct usb_interface *intf,struct usb_device *udev =interface_to_usbdev (intf);struct ieee80211_hw *dev;struct rtl8187_priv *priv; -struct eeprom_93cx6 eeprom; +struct eeprom_93cx6 eeprom = {};struct ieee80211_channel *channel;const char *chip_name;u16 txpwr, reg;
Signature · 1 line
2.50.1
Quoted 10 lines · [email protected] <[email protected]> wrote:
From: Stanislaw Gruszka <[email protected]>
Commit
7738a7ab9d12("misc: eeprom:eeprom_93cx6: Add quirk for extra read clock cycle") added extra 'quirk' field to structeeprom_93cx6.Many existing users of
eeprom_93cx6, including rtl818x drivers, allocate the structure on the stack without initializing all fields. As a result, the added quirk field has an undefined value and can randomly cause reading wrong data from the EEPROM.
Quoted 5 lines
Fix by initializing the structures with {}.
Fixes 7738a7ab9d12 ("misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle")Cc [email protected] # v6.13+Signed-off-by Stanislaw Gruszka <[email protected]>
Quoted 10 lines · [email protected] wrote:
From: Stanislaw Gruszka <[email protected]>
Commit
7738a7ab9d12("misc: eeprom:eeprom_93cx6: Add quirk for extra read clock cycle") added extra 'quirk' field to structeeprom_93cx6.Many existing users of
eeprom_93cx6, including rtl818x drivers, allocate the structure on the stack without initializing all fields. As a result, the added quirk field has an undefined value and can randomly cause reading wrong data from the EEPROM.
Quoted 6 lines
Fix by initializing the structures with {}.
Fixes 7738a7ab9d12 ("misc: eeprom: eeprom_93cx6: Add quirk for extra read clock cycle")Cc [email protected] # v6.13+Signed-off-by Stanislaw Gruszka <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
799b5f45cb81 wifi: rtl818x: initialize eeprom_93cx6 struct to zero