lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/4] staging: r8188eu: add error handling of rtw_read16
On Fri, May 20, 2022 at 12:09:55AM +0300, Pavel Skripkin wrote:
> rtw_read16() reads data from device via USB API which may fail. In case
> of any failure previous code returned stack data to callers, which is
> wrong.
>
> Fix it by changing rtw_read16() prototype and prevent caller from
> touching random stack data
>
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
>
> Changes since v1:
> - Fixed style issue
>
> ---
> .../staging/r8188eu/hal/rtl8188e_hal_init.c | 21 ++++++++++++---
> drivers/staging/r8188eu/hal/rtl8188e_phycfg.c | 8 ++++--
> drivers/staging/r8188eu/hal/usb_halinit.c | 27 ++++++++++++++++---
> drivers/staging/r8188eu/hal/usb_ops_linux.c | 13 ++++++---
> drivers/staging/r8188eu/include/rtw_io.h | 2 +-
> drivers/staging/r8188eu/os_dep/ioctl_linux.c | 9 ++++---
> drivers/staging/r8188eu/os_dep/os_intfs.c | 6 ++++-
> 7 files changed, 67 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> index e67ecbd1ba79..6662ebc30f7b 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> @@ -249,11 +249,14 @@ static void efuse_read_phymap_from_txpktbuf(
> hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H));
>
> if (i == 0) {
> + u16 reg;
> +
> /* Although lenc is only used in a debug statement,
> * do not remove it as the rtw_read16() call consumes
> * 2 bytes from the EEPROM source.
> */
> - rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L);
> + res = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L, &reg);
> + (void)res;

Same here, that line isn't ok.

thanks,

greg k-h

\
 
 \ /
  Last update: 2022-06-06 07:50    [W:0.079 / U:2.748 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site