[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_82E5B6AAC09A3C801490519B242C6EE06A09@qq.com>
Date: Sat, 22 Apr 2023 18:04:47 +0800
From: Zhang Shurong <zhang_shurong@...mail.com>
To: tony0620emma@...il.com
Cc: kvalo@...nel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Zhang Shurong <zhang_shurong@...mail.com>
Subject: [PATCH 03/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rsvd_page
If there is a failure during copy_from_user, rtw_debugfs_set_rsvd_page
should return negative error code instead of a positive value count.
Fix this bug by returning correct error code.
Signed-off-by: Zhang Shurong <zhang_shurong@...mail.com>
---
drivers/net/wireless/realtek/rtw88/debug.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index 3c3350bb2855..d8e872ae4dda 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -291,8 +291,11 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp,
char tmp[32 + 1];
u32 offset, page_num;
int num;
+ int ret;
- rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2);
+ ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2);
+ if (ret < 0)
+ return ret;
num = sscanf(tmp, "%d %d", &offset, &page_num);
--
2.40.0
Powered by blists - more mailing lists