[PATCH 08/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fix_rate
From: Zhang Shurong
Date: Sat Apr 22 2023 - 06:06:37 EST
If there is a failure during copy_from_user, rtw_debugfs_set_fix_rate
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@xxxxxxxxxxx>
---
drivers/net/wireless/realtek/rtw88/debug.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index e033077d49b0..aef43f3ca364 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -488,7 +488,9 @@ static ssize_t rtw_debugfs_set_fix_rate(struct file *filp,
char tmp[32 + 1];
int ret;
- rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+ ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 1);
+ if (ret < 0)
+ return ret;
ret = kstrtou8(tmp, 0, &fix_rate);
if (ret) {
--
2.40.0