> -----Original Message----- > From: lilinmao <lilinmao@xxxxxxxxxx> > Sent: Friday, January 5, 2024 6:46 PM > To: linux-wireless@xxxxxxxxxxxxxxx > Cc: Ping-Ke Shih <pkshih@xxxxxxxxxxx>; kvalo@xxxxxxxxxx; lilinmao <lilinmao@xxxxxxxxxx> > Subject: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues The subject doesn't address the problem or describe the changes you made. Maybe, you can say "fix out of bounds of iqk_mcc_ch[][] array", but actually cppcheck reported a false alarm, doesn't it? [...] > Signed-off-by: lilinmao <lilinmao@xxxxxxxxxx> You should give your real name here as well as "From:" field. > --- > drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > 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 *rtwdev, enum rtw89_phy_idx phy, u > u32 reg_rf18; > u32 reg_35c; > u8 idx; > - u8 get_empty_table = false; > > for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) { > if (iqk_info->iqk_mcc_ch[idx][path] == 0) { > - get_empty_table = true; > break; > } > } > rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK] (1)idx = %x\n", idx); > > - if (!get_empty_table) { > + if (idx > RTW89_IQK_CHS_NR - 1) { > idx = iqk_info->iqk_table_idx[path] + 1; > if (idx > 1) > idx = 0; The original logic looks like bool found = false; for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) if (expr) { found = true; break; } if (!found) { ... [A] } So, idx >= RTW89_IQK_CHS_NR must fall into branch [A]. Can you report this pattern to cppcheck? Ping-Ke