From patchwork Sat Apr 22 10:04:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 13220943 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 8BD01C77B78 for ; Sat, 22 Apr 2023 10:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbjDVKLl (ORCPT ); Sat, 22 Apr 2023 06:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbjDVKLj (ORCPT ); Sat, 22 Apr 2023 06:11:39 -0400 X-Greylist: delayed 380 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sat, 22 Apr 2023 03:11:37 PDT Received: from out203-205-251-88.mail.qq.com (out203-205-251-88.mail.qq.com [203.205.251.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8277E1729; Sat, 22 Apr 2023 03:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158295; bh=XE+xW4zcJKwa46DVTbWJWKZcEJQ/Q3+YX0ZLl0C0gvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KaEvBaLQvIkgQVKMWMyZZG98KAUvh8BEuHoQdRZH13v+SqlJhVzBITnKTfUJHs0qs ehc4Ro9CxMhHkG3JshAChRCSfqOrHrrlXtYhqEwyZdRrsbbY1QophbfNh4oyE+tz+D ZKGjX3EC95ceolg11b4vSnPdpEtP6DN/K7EdxjDo= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.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zQolm58EM9I47F s1t6cnLbqKZs1EzwQYeA4H65+ojcfUzDDLIZRFV3jD8PANnhEioGUDPM6AhJtF+nhOKHmgJKoEzs ViqEoJe5lxt9u1aM7/1k3Irh9CxNqWuBX/7SFxLiZUhSa9HlmBb12xSbLuPCDBqGFLHOU43VrLBn pGz9QWX5iGlpcnX8o= 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 04/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_single_input Date: Sat, 22 Apr 2023 18:04:48 +0800 X-OQ-MSGID: <5c743fefab84f1d490a73c61fe0a3cb0310a5677.1682156784.git.zhang_shurong@foxmail.com> 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_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 --- 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);