From patchwork Sat Apr 22 10:04:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 13220937 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11607C6FD18 for ; Sat, 22 Apr 2023 10:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjDVKGa (ORCPT ); Sat, 22 Apr 2023 06:06:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbjDVKG3 (ORCPT ); Sat, 22 Apr 2023 06:06:29 -0400 X-Greylist: delayed 79 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 22 Apr 2023 03:06:25 PDT Received: from out203-205-221-250.mail.qq.com (out203-205-221-250.mail.qq.com [203.205.221.250]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACECC1BC3; Sat, 22 Apr 2023 03:06:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682157983; bh=ZVHvqzotBOxirfSKO82CUWP0DLUkcEMYWq+fWqQiZB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SuY4vanW9TbMyICI++qkAq6DzG3fF22ubN9xzEUm1B+uQ9Tex/TfLLJCeO/Jr7PYp ykj4f7ivsWN+RXLVUS6ZT187BiHGuSdzjs2UOoHSyhWgTtQRC1w4I6BRuZJ/6FcHUE Hggdo8xMtBe++HpC6NiniuKW4uSSXhKZapkuzjDw= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0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L1GMNmPgiDcmFtL/4cB zthBXknJiXBjM+Zgmxrq5Z8ZUgiBps9rYQX3TB0tGd/cE9Oinbzq6kJVL6O/3m4ZxqWYKrOoNRT5 ceOly5i1lqXNEyQ1QIEaNuLJaJTg3NDZb143+UfKltabY9QNom From: Zhang Shurong 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 Subject: [PATCH 08/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_fix_rate Date: Sat, 22 Apr 2023 18:04:52 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.40.0 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- 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) {