summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-07-13 09:58:04 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-07-14 15:47:21 +0200
commitc1da5a7befa82c01e06c8ec2059bdc9ed422033b (patch)
treec076f13ca66895ed7512c06495eb5132a34974a2 /drivers/staging
parent4cdb845db3217091737159908fcba1f643d818a1 (diff)
downloadlinux-stable-c1da5a7befa82c01e06c8ec2059bdc9ed422033b.tar.gz
linux-stable-c1da5a7befa82c01e06c8ec2059bdc9ed422033b.tar.bz2
linux-stable-c1da5a7befa82c01e06c8ec2059bdc9ed422033b.zip
staging: r888eu: use dynamic allocation for efuse buffer
Use kmalloc to allocate the efuse buffer in ReadAdapterInfo8188EU and free it on exit. This is better than using a 512 byte array on the stack. It's ok to drop the __aligned(4) qualifier. kmalloc aligns to ARCH_KMALLOC_MINALIGN, this is at least 8 bytes. Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Larry Finger <Larry.Finger@lwfinger.net> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220713075804.140986-1-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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
index 68d012a442a8..695424bbecfc 100644
--- a/drivers/staging/r8188eu/hal/usb_halinit.c
+++ b/drivers/staging/r8188eu/hal/usb_halinit.c
@@ -927,7 +927,7 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
{
struct eeprom_priv *eeprom = &Adapter->eeprompriv;
struct led_priv *ledpriv = &Adapter->ledpriv;
- u8 efuse_buf[EFUSE_MAP_LEN_88E] __aligned(4);
+ u8 *efuse_buf;
u8 eeValue;
int res;
@@ -938,7 +938,10 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
eeprom->bautoload_fail_flag = !(eeValue & EEPROM_EN);
- memset(efuse_buf, 0xFF, sizeof(efuse_buf));
+ efuse_buf = kmalloc(EFUSE_MAP_LEN_88E, GFP_KERNEL);
+ if (!efuse_buf)
+ return;
+ memset(efuse_buf, 0xFF, EFUSE_MAP_LEN_88E);
if (!(eeValue & BOOT_FROM_EEPROM) && !eeprom->bautoload_fail_flag) {
rtl8188e_EfusePowerSwitch(Adapter, true);
@@ -958,6 +961,7 @@ void ReadAdapterInfo8188EU(struct adapter *Adapter)
Hal_ReadThermalMeter_88E(Adapter, efuse_buf, eeprom->bautoload_fail_flag);
ledpriv->bRegUseLed = true;
+ kfree(efuse_buf);
}
static void ResumeTxBeacon(struct adapter *adapt)