diff mbox series

[v1] drivers: fix the parameter bin reference preceded by free

Message ID 20230601072322.486-1-duminjie@vivo.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [v1] drivers: fix the parameter bin reference preceded by free | expand

Commit Message

Minjie Du June 1, 2023, 7:23 a.m. UTC
We assign the variable bin to NULL,
fix variable bin reference preceded by free.

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 drivers/net/wireless/realtek/rtw89/debug.c | 1 +
 1 file changed, 1 insertion(+)

--
2.25.1

Comments

Ping-Ke Shih June 1, 2023, 7:41 a.m. UTC | #1
> -----Original Message-----
> From: Minjie Du <duminjie@vivo.com>
> Sent: Thursday, June 1, 2023 3:23 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; kvalo@kernel.org
> Cc: linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org; Minjie Du <duminjie@vivo.com>
> Subject: [PATCH v1] drivers: fix the parameter bin reference preceded by free

subject prefix should be "wifi: rtw89: fix ... "

> 
> We assign the variable bin to NULL,
> fix variable bin reference preceded by free.
> 
> Signed-off-by: Minjie Du <duminjie@vivo.com>
> ---
>  drivers/net/wireless/realtek/rtw89/debug.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
> index 6f418f14ec3f..4541b4d48e69 100644
> --- a/drivers/net/wireless/realtek/rtw89/debug.c
> +++ b/drivers/net/wireless/realtek/rtw89/debug.c
> @@ -2982,6 +2982,7 @@ static u8 *rtw89_hex2bin_user(struct rtw89_dev *rtwdev,
>         if (hex2bin(bin, buf, num)) {
>                 rtw89_info(rtwdev, "valid format: H1H2H3...\n");
>                 kfree(bin);
> +               bin = NULL;
>                 err = -EINVAL;
>         }


Do you meet real problem? or code checker finds this? 

When 'err' is set, we don't touch 'bin' anymore. 

Ping-Ke
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 6f418f14ec3f..4541b4d48e69 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -2982,6 +2982,7 @@  static u8 *rtw89_hex2bin_user(struct rtw89_dev *rtwdev,
        if (hex2bin(bin, buf, num)) {
                rtw89_info(rtwdev, "valid format: H1H2H3...\n");
                kfree(bin);
+               bin = NULL;
                err = -EINVAL;
        }