* [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
@ 2023-07-15 13:42 Zhang Shurong
2023-07-17 1:28 ` Ping-Ke Shih
2023-07-25 14:45 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Zhang Shurong @ 2023-07-15 13:42 UTC (permalink / raw)
To: pkshih, Markus.Elfring, kuba
Cc: kvalo, linux-wireless, linux-kernel, Zhang Shurong
If there is a failure during kstrtobool_from_user()
rtw89_debug_priv_btc_manual_set should return a negative error code
instead of returning the count directly.
Fix this bug by returning an error code instead of a count after
a failed call of the function "kstrtobool_from_user". Moreover
I omitted the label "out" with this source code correction.
Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
Changes in v2:
- Corrected the format of this patch
- Used variable ret instead of goto out
Changes in v3:
- Improved change description
Changes in v4:
- Improved change description
drivers/net/wireless/realtek/rtw89/debug.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index a4bbac916e22..ce5a9ac08145 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3193,12 +3193,14 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp,
struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;
struct rtw89_btc *btc = &rtwdev->btc;
bool btc_manual;
+ int ret;
- if (kstrtobool_from_user(user_buf, count, &btc_manual))
- goto out;
+ ret = kstrtobool_from_user(user_buf, count, &btc_manual);
+ if (ret)
+ return ret;
btc->ctrl.manual = btc_manual;
-out:
+
return count;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
2023-07-15 13:42 [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set() Zhang Shurong
@ 2023-07-17 1:28 ` Ping-Ke Shih
2023-07-25 14:45 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2023-07-17 1:28 UTC (permalink / raw)
To: Zhang Shurong, Markus.Elfring@web.de, kuba@kernel.org
Cc: kvalo@kernel.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Zhang Shurong <zhang_shurong@foxmail.com>
> Sent: Saturday, July 15, 2023 9:43 PM
> To: Ping-Ke Shih <pkshih@realtek.com>; Markus.Elfring@web.de; kuba@kernel.org
> Cc: kvalo@kernel.org; linux-wireless@vger.kernel.org; linux-kernel@vger.kernel.org; Zhang Shurong
> <zhang_shurong@foxmail.com>
> Subject: [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
>
> If there is a failure during kstrtobool_from_user()
> rtw89_debug_priv_btc_manual_set should return a negative error code
> instead of returning the count directly.
>
> Fix this bug by returning an error code instead of a count after
> a failed call of the function "kstrtobool_from_user". Moreover
> I omitted the label "out" with this source code correction.
>
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
> Changes in v2:
> - Corrected the format of this patch
> - Used variable ret instead of goto out
> Changes in v3:
> - Improved change description
> Changes in v4:
> - Improved change description
>
Normally, we preserve three '-' as delimiter here. I tried to use pwclient to
apply this patch, and fortunately it works. So, I think no need to resend because
of this.
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
2023-07-15 13:42 [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set() Zhang Shurong
2023-07-17 1:28 ` Ping-Ke Shih
@ 2023-07-25 14:45 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-07-25 14:45 UTC (permalink / raw)
To: Zhang Shurong
Cc: pkshih, Markus.Elfring, kuba, linux-wireless, linux-kernel,
Zhang Shurong
Zhang Shurong <zhang_shurong@foxmail.com> wrote:
> If there is a failure during kstrtobool_from_user()
> rtw89_debug_priv_btc_manual_set should return a negative error code
> instead of returning the count directly.
>
> Fix this bug by returning an error code instead of a count after
> a failed call of the function "kstrtobool_from_user". Moreover
> I omitted the label "out" with this source code correction.
>
> Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Patch applied to wireless-next.git, thanks.
59b4cc439f18 wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
--
https://patchwork.kernel.org/project/linux-wireless/patch/tencent_1C09B99BD7DA9CAD18B00C8F0F050F540607@qq.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-25 14:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-15 13:42 [PATCH v4] wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set() Zhang Shurong
2023-07-17 1:28 ` Ping-Ke Shih
2023-07-25 14:45 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox