Search Linux Wireless

RE: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Kalle Valo <kvalo@xxxxxxxxxx>
> Sent: Monday, January 8, 2024 11:24 PM
> To: lilinmao <lilinmao@xxxxxxxxxx>
> Cc: Ping-Ke Shih <pkshih@xxxxxxxxxxx>; linux-wireless@xxxxxxxxx… <linux-wireless@xxxxxxxxxxxxxxx>
> Subject: Re: [PATCH] wifi: rtw89: 8852b: fix cppcheck issues
> 
> lilinmao <lilinmao@xxxxxxxxxx> writes:
> 
> > I'm very sorry for the various issues encountered during my first patch submission.
> >
> > My patch didn't change the original logic of the code.Perhaps I just changed the way
> > of writing the code to avoid the cppcheck issue.

Yes. I think you didn't change the logic, so explain this and what you made
in commit message as Johannes mentioned. 

> >
> >>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]
> >>}
> >
> > After the 'for' loop ends, 'if (idx > RTW89_IQK_CHS_NR - 1)' is
> > equivalent to 'if (!found). 

I prefer 'if (idx >= RTW89_IQK_CHS_NR)'

> > Cppcheck might not have detected the
> > changes to 'idx' within branch [A] which leads it to believe later
> > that 'idx' could be greater than or equal to 'RTW89_IQK_CHS_NR'.

So, can you refine cppcheck? 

> 
> Our lists drop all html mail, so please use text/plain format and don't
> top post. More info in the wiki link below.
> 

Thank you, Kalle. With your reformatting, I can simply reply this. :-)







[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux