2023-06-01 07:26:48

by Minjie Du

[permalink] [raw]
Subject: [PATCH v1] drivers: fix the parameter bin reference preceded by free

We assign the variable bin to NULL,
fix variable bin reference preceded by free.

Signed-off-by: Minjie Du <[email protected]>
---
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;
}

--
2.25.1


________________________________
本邮件及其附件内容可能含有机密和/或隐私信息,仅供指定个人或机构使用。若您非发件人指定收件人或其代理人,请勿使用、传播、复制或存储此邮件之任何内容或其附件。如您误收本邮件,请即以回复或电话方式通知发件人,并将原始邮件、附件及其所有复本删除。谢谢。
The contents of this message and any attachments may contain confidential and/or privileged information and are intended exclusively for the addressee(s). If you are not the intended recipient of this message or their agent, please note that any use, dissemination, copying, or storage of this message or its attachments is not allowed. If you receive this message in error, please notify the sender by reply the message or phone and delete this message, any attachments and any copies immediately.
Thank you


2023-06-01 07:47:23

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH v1] drivers: fix the parameter bin reference preceded by free



> -----Original Message-----
> From: Minjie Du <[email protected]>
> Sent: Thursday, June 1, 2023 3:23 PM
> To: Ping-Ke Shih <[email protected]>; [email protected]
> Cc: [email protected]; [email protected]; Minjie Du <[email protected]>
> 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 <[email protected]>
> ---
> 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