Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1382206rdb; Sun, 7 Jan 2024 17:50:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqfyOQe7Fq1XGY3VMRB4a5BOb6xadjcLq11CBdsalgrCfbxseekpn79i7oLvyOuwywoJfY X-Received: by 2002:a05:6e02:18cb:b0:360:3d9:f5aa with SMTP id s11-20020a056e0218cb00b0036003d9f5aamr6487823ilu.129.1704678619011; Sun, 07 Jan 2024 17:50:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704678618; cv=none; d=google.com; s=arc-20160816; b=HE8+JqbiTLRdV3H4Oh+tDl/uyeVUUyZvCrfypVR+6KhNJyZojIkKDbtciTtAkZZ07P 7S58AfvAcl4uRP9e+GRAxZsOmmVzXJjNichGATZQdtvCsLEhTu1zcah/WPSQxGD0IBBI YYN0fj0Af2mHftgFl2dVSZ/B8wQg+KcnL+Xv9dMxKiNaFBVjxIkZ2e1VVDFME9T8dnRD xE/CGf+DqhZfR+qTuH3X0TaulT8b1j92H+AHyx7975PyvmbiCBQraqEIxFP16OCGBvK/ kGly2jW42H9j9gdR3s2us/fnD86LLDHFnGMrwnKI5kl5c9y8ZpD/0PpDrz+VSJPu9FHJ Q7zQ== 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=lDrEJDZ3XyPP7hal/LcNtKTgffEzxnsrkG4cvEq7eb0=; fh=3YiS8cmpkIj9CVwYOSLDAHqzHFP1Z94S7ZeVYFqfo1o=; b=oWTR3Ihy1rNo7HwNBwpVWjgSuH4hWXX+ySQtPGB2koh2eP5Y9VTz4TTNtqRj1DL4oI Ud/IHGCBLspvGH5uU442eYuRjC8kwNXqZniJ8hmYZMZ29R9tfq7RDracwb58MUVoj/zu PcK2SBHVQOKvcs0UuYsLeHczKjTnLOolepHlJ7G9efWOKnaZ2GS1X98vhFAmQezfa2aK hEvUEbAb6w3+lIrJnv/LM8fqYw+2zR+0OumzSiDI0fAWbSiDAU/bQ2dfy6R0k6viJOaR OQriR4OHsftdr69SqVKHeKCeW/PSzwozbOaivifM3C35gEDf72u13TlM7gKoQ6P9Y3Ng pSwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1561-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s15-20020a170902a50f00b001d4bc19d7d9si4967907plq.653.2024.01.07.17.50.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 17:50:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1561-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1561-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 2B685B20EA5 for ; Mon, 8 Jan 2024 01:50:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90104B642; Mon, 8 Jan 2024 01:49:40 +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 B73F4B641 for ; Mon, 8 Jan 2024 01:49:37 +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 4081n7I313626579, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 4081n7I313626579 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Jan 2024 09:49:08 +0800 Received: from RTEXDAG01.realtek.com.tw (172.21.6.100) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Mon, 8 Jan 2024 09:49:07 +0800 Received: from RTEXDAG02.realtek.com.tw (172.21.6.101) 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; Mon, 8 Jan 2024 09:49:07 +0800 Received: from RTEXDAG02.realtek.com.tw ([fe80::5d58:7838:d352:d6b8]) by RTEXDAG02.realtek.com.tw ([fe80::5d58:7838:d352:d6b8%5]) with mapi id 15.01.2375.007; Mon, 8 Jan 2024 09:49:07 +0800 From: Ping-Ke Shih To: lilinmao , "linux-wireless@vger.kernel.org" CC: "kvalo@kernel.org" Subject: RE: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues Thread-Topic: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues Thread-Index: AQHaP8RbPkhvE92icEK7ZcmuR2v5v7DPJ5RQ Date: Mon, 8 Jan 2024 01:49:07 +0000 Message-ID: References: <20240105104542.463834-1-lilinmao@kylinos.cn> In-Reply-To: <20240105104542.463834-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 > -----Original Message----- > From: lilinmao > Sent: Friday, January 5, 2024 6:46 PM > To: linux-wireless@vger.kernel.org > Cc: Ping-Ke Shih ; kvalo@kernel.org; lilinmao > Subject: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues The subject doesn't address the problem or describe the changes you made.=20 Maybe, you can say "fix out of bounds of iqk_mcc_ch[][] array", but actuall= y cppcheck reported a false alarm, doesn't it? [...] > Signed-off-by: lilinmao You should give your real name here as well as "From:" field.=20 > --- > 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..03dec3f4e7ba 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 > RTW89_IQK_CHS_NR - 1) { > idx =3D iqk_info->iqk_table_idx[path] + 1; > if (idx > 1) > idx =3D 0; The original logic looks like bool found =3D false; for (idx =3D 0; idx < RTW89_IQK_CHS_NR; idx++) if (expr) { found =3D true; break; } if (!found) {=20 ... [A] } So, idx >=3D RTW89_IQK_CHS_NR must fall into branch [A]. Can you report thi= s pattern to cppcheck? Ping-Ke=20