summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-07-09 19:09:52 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-11 10:06:45 +0200
commit0fcae03da0d80af6138c911a127b3d9ab5dc7fe8 (patch)
treee482c439f627025f62b6c80cc14d4fc691953a5a /drivers/staging
parentstaging: r8188eu: use a local buffer for efuse data (diff)
downloadlinux-0fcae03da0d80af6138c911a127b3d9ab5dc7fe8.tar.xz
linux-0fcae03da0d80af6138c911a127b3d9ab5dc7fe8.zip
staging: r8188eu: always initialise efuse buffer with 0xff
If BOOT_FROM_EEPROM is set, efuse_buf is not initialised before it is passed to functions that read from it. The buffer will be filled with 0x00 in this case like all local variables. However, the parsing functions expect the buffer to be filled with 0xFF if reading eeprom/efuse data failed. Fill the buffer with 0xFF before we try to read the data. Please note that this problem existed before we started using a local buffer. Adapter->eeprompriv->efuse_eeprom_data was allocated as a part of struct adapter by a vzalloc call in rtw_usb_if1_init. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220709171000.180481-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/r8188eu/hal/usb_halinit.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 32f25312ffd7..16ac5b49459a 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -940,14 +940,12 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
eeprom->bautoload_fail_flag = !(eeValue & EEPROM_EN);
- if (!(eeValue & BOOT_FROM_EEPROM)) {
- if (eeprom->bautoload_fail_flag) {
- memset(efuse_buf, 0xFF, sizeof(efuse_buf));
- } else {
- rtl8188e_EfusePowerSwitch(Adapter, true);
- rtl8188e_ReadEFuse(Adapter, 0, EFUSE_MAP_LEN_88E, efuse_buf);
- rtl8188e_EfusePowerSwitch(Adapter, false);
- }
+ memset(efuse_buf, 0xFF, sizeof(efuse_buf));
+
+ if (!(eeValue & BOOT_FROM_EEPROM) && !eeprom->bautoload_fail_flag) {
+ rtl8188e_EfusePowerSwitch(Adapter, true);
+ rtl8188e_ReadEFuse(Adapter, 0, EFUSE_MAP_LEN_88E, efuse_buf);
+ rtl8188e_EfusePowerSwitch(Adapter, false);
}
/* parse the eeprom/efuse content */