From patchwork Sat Apr 22 10:04:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676308 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 0DA60C7618E for ; Sat, 22 Apr 2023 10:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbjDVKMh (ORCPT ); Sat, 22 Apr 2023 06:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjDVKMM (ORCPT ); Sat, 22 Apr 2023 06:12:12 -0400 Received: from out203-205-221-249.mail.qq.com (out203-205-221-249.mail.qq.com [203.205.221.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19AA271C; Sat, 22 Apr 2023 03:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158308; bh=AiHaweSI9v1B2EKsrPZKFyxUxyDMJ+lDNtxzoXG3z3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q8sl5ZZPJOS+KLV3bMXaR0lxI1BGXiSd6vwlYmevTTHOOwNxer6PH5lPDSOoKaVcL u+xQ+hsHj5L92Srh96a+OzHBUyqL0fpiOcN91rcs4UxGhv8EONjJK7SnxAHOK4dv8G k3DfmpYWEFSrix2nQDqeH054dk8UFcKoXH4VBmUE= Received: from localhost.localdomain ([49.7.199.72]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id 1402C0F4; Sat, 22 Apr 2023 18:05:00 +0800 X-QQ-mid: xmsmtpt1682157926th7ubsyc9 Message-ID: X-QQ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RLWGiOTFex4HUAJaHBYOE1L+JCzo8yhFIZHaVf 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 05/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_h2c Date: Sat, 22 Apr 2023 18:04:49 +0800 X-OQ-MSGID: <71d87586fb8e306ea9ed5ccde7e5a98be52e4c0c.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_h2c 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 f721205185cf..911f0514c497 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -393,8 +393,11 @@ static ssize_t rtw_debugfs_set_h2c(struct file *filp, char tmp[32 + 1]; u8 param[8]; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 3); + if (ret < 0) + return ret; num = sscanf(tmp, "%hhx,%hhx,%hhx,%hhx,%hhx,%hhx,%hhx,%hhx", ¶m[0], ¶m[1], ¶m[2], ¶m[3],