lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 13 Jul 2022 08:24:25 -0500
From:   Larry Finger <Larry.Finger@...inger.net>
To:     Martin Kaiser <martin@...ser.cx>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Phillip Potter <phil@...lpotter.co.uk>,
        Michael Straube <straube.linux@...il.com>,
        Pavel Skripkin <paskripkin@...il.com>,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH] staging: r888eu: use dynamic allocation for efuse buffer

On 7/13/22 02:58, Martin Kaiser wrote:
> 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@...cle.com>
> Suggested-by: Larry Finger <Larry.Finger@...inger.net>
> Signed-off-by: Martin Kaiser <martin@...ser.cx>
> ---
>   drivers/staging/r8188eu/hal/usb_halinit.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/hal/usb_halinit.c b/drivers/staging/r8188eu/hal/usb_halinit.c
> index 8902dda7b8d8..421fe7c40390 100644
> --- a/drivers/staging/r8188eu/hal/usb_halinit.c
> +++ b/drivers/staging/r8188eu/hal/usb_halinit.c
> @@ -926,7 +926,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;
>   
> @@ -937,7 +937,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);
> @@ -957,6 +960,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)

Acked-by: Larry Finger <Larry.Finger@...inger.net>

Thanks,

Larry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ