mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Shurong <zhang_shurong@foxmail.com>
To: tony0620emma@gmail.com
Cc: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Zhang Shurong <zhang_shurong@foxmail.com>
Subject: [PATCH 04/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_single_input
Date: Sat, 22 Apr 2023 18:04:48 +0800	[thread overview]
Message-ID: <tencent_4D24DA6FF46A2DB766C0483DD0143A51F309@qq.com> (raw)
In-Reply-To: <cover.1682156784.git.zhang_shurong@foxmail.com>

If there is a failure during copy_from_user, rtw_debugfs_set_single_input
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@foxmail.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 d8e872ae4dda..f721205185cf 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -320,8 +320,11 @@ static ssize_t rtw_debugfs_set_single_input(struct file *filp,
 	char tmp[32 + 1];
 	u32 input;
 	int num;
+	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;
 
 	num = kstrtoint(tmp, 0, &input);
 
-- 
2.40.0


  parent reply	other threads:[~2023-04-22 10:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1682156784.git.zhang_shurong@foxmail.com>
2023-04-22 10:04 ` [PATCH 01/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_write_reg Zhang Shurong
2023-04-24  1:58   ` Ping-Ke Shih
2023-04-24  6:28     ` foxmail
2023-04-22 10:04 ` [PATCH 02/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_read_reg Zhang Shurong
2023-04-22 10:04 ` [PATCH 03/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rsvd_page Zhang Shurong
2023-04-22 10:04 ` Zhang Shurong [this message]
2023-04-22 10:04 ` [PATCH 05/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_h2c Zhang Shurong
2023-04-22 10:04 ` [PATCH 06/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rf_write Zhang Shurong
2023-04-22 10:04 ` [PATCH 07/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rf_read Zhang Shurong
2023-04-22 10:04 ` [PATCH 08/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fix_rate Zhang Shurong
2023-04-22 10:04 ` [PATCH 09/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_coex_enable Zhang Shurong
2023-04-22 10:04 ` [PATCH 10/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fw_crash Zhang Shurong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_4D24DA6FF46A2DB766C0483DD0143A51F309@qq.com \
    --to=zhang_shurong@foxmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tony0620emma@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®