Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp774048rdd; Tue, 9 Jan 2024 21:48:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMPVf2kEJAAxKWzdDnt86dG0Xm5zfNuFRpKH1yKTzq3rWVzSuE5taYV67a7kt7+LGLON04 X-Received: by 2002:a17:906:1e44:b0:a27:92df:eddf with SMTP id i4-20020a1709061e4400b00a2792dfeddfmr251073ejj.151.1704865729007; Tue, 09 Jan 2024 21:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704865728; cv=none; d=google.com; s=arc-20160816; b=qhuypZG3Hdbyn32tY5r1++IR76eFEt5J6TRo6odfhdX4e3gvtmnYZpkXOA8urgvgU9 ZfoxstoQYx0ObF41ZUfvsiaArJorNGhtZVR1sSP7ofLvzDEYDybiAUA9i2Z2kpin+vwG 7cHi2/4SG/fkLnXQsdbbfRTWIy0qzwRs/gQQgNEQMUed4UCILGSm7HrZefq43ZT8oyVI 2cpGfAf+q7y7TDSE6dUds5ceAIaYnw2Dvb1aOTt6Nnj+3kvHsQ//L/1mwzxbZNwKsBrv wDsFXdgt+0f5d8kT015uLyp2DEnPETSRAVlhp1cQKIwHMpCrhTkOPH9j4OQcSQRvWBEi FEUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=N6vm5XQuIoOeV2A45A2EY4CT7zSb/MEERfC4t18JaLg=; fh=dfKNiCH2Dfqof9CROZoYicxfd+YvqdtaGfqzakXipKg=; b=Ev/TWwb5wygMfLcgYiWJZNWFQ+xxrl59BBIVK09KUubdaZCUS1AHVQFZtQ29B9hJ7f p3ZhOvR56rwv6wPe1bHAD4AaRMHwk+yMQ7O7YOjDgOHPkKN4oK75RkUsk27MOkmsYTCd FOWocr/WGCOmFm9y8GM3o98bY22G625uGugK3/VrE3KJuqmcpmppC+rlvtf08mBvzQGg IVS9/vlRblkvYfvKqlDYfd5Winm0b9bU/AIXCzFe1XNsYx7KQLABV144SjkpHXtoR51g QUOJ6wu0nfLe0UOLZQ1wdmAyz9QA50aj4XfOyGcvi0wcml0fJOx2bOM8Vzm6n/jv6rLZ WF8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1649-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cf2-20020a170906b2c200b00a2877fc8504si1481223ejb.411.2024.01.09.21.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 21:48:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1649-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1649-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B309B1F26D07 for ; Wed, 10 Jan 2024 05:48:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9454DF55; Wed, 10 Jan 2024 05:48:44 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C4C3DDD5 for ; Wed, 10 Jan 2024 05:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 40A5mSuQ5860907, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 40A5mSuQ5860907 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2024 13:48:30 +0800 Received: from RTEXDAG01.realtek.com.tw (172.21.6.100) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Wed, 10 Jan 2024 13:48:28 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXDAG01.realtek.com.tw (172.21.6.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 10 Jan 2024 13:48:28 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::e4c4:c4f:4e4c:d23c]) by RTEXMBS04.realtek.com.tw ([fe80::e4c4:c4f:4e4c:d23c%5]) with mapi id 15.01.2507.035; Wed, 10 Jan 2024 13:48:28 +0800 From: Ping-Ke Shih To: Li Lin Mao , "linux-wireless@vger.kernel.org" CC: "kvalo@kernel.org" Subject: RE: [PATCH v2] wifi: rtw89: 8852b: avoid reporting errors by cppcheck Thread-Topic: [PATCH v2] wifi: rtw89: 8852b: avoid reporting errors by cppcheck Thread-Index: AQHaQ3v5NQKCFMN/G0mgePLSUJwh3rDSh6og Date: Wed, 10 Jan 2024 05:48:28 +0000 Message-ID: <92f7e7f317bf4e6bb68ce385b0c1e119@realtek.com> References: <20240110041736.2809393-1-lilinmao@kylinos.cn> In-Reply-To: <20240110041736.2809393-1-lilinmao@kylinos.cn> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-kse-serverinfo: RTEXDAG01.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback > -----Original Message----- > From: Li Lin Mao > Sent: Wednesday, January 10, 2024 12:18 PM > To: linux-wireless@vger.kernel.org > Cc: Ping-Ke Shih ; kvalo@kernel.org; Li Lin Mao > Subject: [PATCH v2] wifi: rtw89: 8852b: avoid reporting errors by cppchec= k The subject should specify what you are fixing. If you send two patches to correct two different cppcheck errors, how can we address their differences by subject? I mean your subject is too common, like checkpatch.pl will throw out warning if cppcheck is added: # Check email subject for common tools that don't need to be mentioned if ($in_header_lines && $line =3D~ /^Subject:.*\b(?:checkpatch|sparse|smatch)\b= [^:]/i) { WARN("EMAIL_SUBJECT", "A patch subject line should describe the chan= ge not the tool that found it\n" . $herecurr); } >=20 > Due to some reasons in cppcheck, the following issues might be reported: I think you can mention the "reason" -- out of bounds.=20 > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1414:22: error: Array > 'iqk_info->iqk_mcc_ch[2][4]' accessed at index iqk_info->iqk_mcc_ch[2][*= ], > which is out of bounds. [arrayIndexOutOfBounds] > iqk_info->iqk_mcc_ch[idx][path] =3D chan->channel; > ^ > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1393:2: note: After for > loop, idx has value 2 > for (idx =3D 0; idx < RTW89_IQK_CHS_NR; idx++) { > ^ > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1414:22: note: Array in= dex > out of bounds > iqk_info->iqk_mcc_ch[idx][path] =3D chan->channel; > ^ > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1424:38: error: Array > 'iqk_info->iqk_mcc_ch[2][4]' accessed at index iqk_info->iqk_mcc_ch[2][*]= , > which is out of bounds. [arrayIndexOutOfBounds] > idx, path, iqk_info->iqk_mcc_ch[idx][path]); > ^ > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1393:2: note: After for > loop, idx has value 2 > for (idx =3D 0; idx < RTW89_IQK_CHS_NR; idx++) { > ^ > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c:1424:38: note: Array in= dex > out of bounds > idx, path, iqk_info->iqk_mcc_ch[idx][path]); > ^ > But actually this might be a false alarm. We avoided it in some way. >=20 > Signed-off-by: Ping-Ke Shih Sorry. I have not signed this patch. Please remove my s-o-b. > Signed-off-by: Li Lin Mao > --- > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) >=20 > diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c > b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c > index 259df67836a0..03169287667c 100644 > --- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c > +++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c > @@ -1388,17 +1388,15 @@ static void _iqk_get_ch_info(struct rtw89_dev *rt= wdev, enum rtw89_phy_idx phy, u > u32 reg_rf18; > u32 reg_35c; > u8 idx; > - u8 get_empty_table =3D false; >=20 > for (idx =3D 0; idx < RTW89_IQK_CHS_NR; idx++) { > if (iqk_info->iqk_mcc_ch[idx][path] =3D=3D 0) { > - get_empty_table =3D true; > break; > } > } > rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK] (1)idx =3D %x\n", idx); >=20 > - if (!get_empty_table) { > + if (idx >=3D RTW89_IQK_CHS_NR) { > idx =3D iqk_info->iqk_table_idx[path] + 1; > if (idx > 1) > idx =3D 0; rtw8852a has similar problem. Doesn't cppcheck report the same warning?