From: Greg KH <gregkh@linuxfoundation.org>
To: Pavel Skripkin <paskripkin@gmail.com>
Cc: Larry.Finger@lwfinger.net, phil@philpotter.co.uk,
straube.linux@gmail.com, dan.carpenter@oracle.com,
fmdefrancesco@gmail.com, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH v2 2/4] staging: r8188eu: add error handling of rtw_read16
Date: Mon, 6 Jun 2022 07:48:49 +0200 [thread overview]
Message-ID: <Yp2VQU9G1xVw9lHE@kroah.com> (raw)
In-Reply-To: <fd10125ab8f4a64572742ec01d3202af2a79b1d0.1652994483.git.paskripkin@gmail.com>
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, ®);
> + (void)res;
Same here, that line isn't ok.
thanks,
greg k-h
next prev parent reply other threads:[~2022-06-06 5:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-19 21:09 [PATCH v2 0/4] staging: r8188eu: add error handling of usb read errors Pavel Skripkin
2022-05-19 21:09 ` [PATCH v2 1/4] staging: r8188eu: add error handling of rtw_read8 Pavel Skripkin
2022-06-06 5:48 ` Greg KH
2022-06-06 18:57 ` Pavel Skripkin
2022-05-19 21:09 ` [PATCH v2 2/4] staging: r8188eu: add error handling of rtw_read16 Pavel Skripkin
2022-06-06 5:48 ` Greg KH [this message]
2022-06-06 19:00 ` Pavel Skripkin
2022-05-19 21:10 ` [PATCH v2 3/4] staging: r8188eu: add error handling of rtw_read32 Pavel Skripkin
2022-05-20 7:43 ` [PATCH v2 0/4] staging: r8188eu: add error handling of usb read errors Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yp2VQU9G1xVw9lHE@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Larry.Finger@lwfinger.net \
--cc=dan.carpenter@oracle.com \
--cc=fmdefrancesco@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=paskripkin@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox