Search Linux Wireless

[PATCH] wifi: rtw89: debug: fix error code in rtw89_debug_priv_btc_manual_set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there is a failure during kstrtobool_from_user()
rtw89_debug_priv_btc_manual_set should return negative error code
instead of a positive value count. Fix this bug by returning
correct error code.

Fixes: e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")

Signed-off-by: Zhang Shurong <zhang_shurong@xxxxxxxxxxx>
---
 drivers/net/wireless/realtek/rtw89/debug.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c
index 1db2d59d33ff..35fe6b4ad9b3 100644
--- a/drivers/net/wireless/realtek/rtw89/debug.c
+++ b/drivers/net/wireless/realtek/rtw89/debug.c
@@ -3192,9 +3192,13 @@ 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))
+	ret = kstrtobool_from_user(user_buf, count, &btc_manual);
+	if (ret) {
+		count = ret;
 		goto out;
+	}
 
 	btc->ctrl.manual = btc_manual;
 out:
-- 
2.30.2




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux