From patchwork Sat Apr 22 10:04:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Shurong X-Patchwork-Id: 676310 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 55720C7618E for ; Sat, 22 Apr 2023 10:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbjDVKLp (ORCPT ); Sat, 22 Apr 2023 06:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbjDVKLn (ORCPT ); Sat, 22 Apr 2023 06:11:43 -0400 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 E1BA119AD; Sat, 22 Apr 2023 03:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1682158299; bh=8leUxeAPv62+4h4KjkbMWeydD4pGRjvCLJYv5hfyOdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LFNKt0TV3shD5sVqSFrZPSkx32eBER9jc5o65n+qPhkNsDV+VFsQ3EIm2nI6k4jj3 BokLxgbk1ygO4tJSD5n7VhDoa4bl/mMf/A6d06NQMthpy089yCbWrez6MoKpIwQFQf 38h7LKYpwfjzsoHAs0p3DyQ0T7KEHsA+WDqE6b14= 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: xmsmtpt1682157919tv67qvjy7 Message-ID: X-QQ-XMAIL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TMAYzaTG7mkZwvIjD4RXICUCJequqBhI0RS3nVr+6gyfkg== 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 03/10] wifi: rtw88: fix incorrect error codes in rtw_debugfs_set_rsvd_page Date: Sat, 22 Apr 2023 18:04:47 +0800 X-OQ-MSGID: <38dcded193f4febdd0a7731229efe94e75d303ce.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_rsvd_page 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 3c3350bb2855..d8e872ae4dda 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -291,8 +291,11 @@ static ssize_t rtw_debugfs_set_rsvd_page(struct file *filp, char tmp[32 + 1]; u32 offset, page_num; int num; + int ret; - rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + ret = rtw_debugfs_copy_from_user(tmp, sizeof(tmp), buffer, count, 2); + if (ret < 0) + return ret; num = sscanf(tmp, "%d %d", &offset, &page_num);