Re: [PATCH] brcmfmac: fix a loop exit condition

Johannes Berg
2021-04-23T12:54:22Z

On Fri, 2021-04-23 at 14:20 +0200, Christophe JAILLET wrote:
>
> > > > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
> > > > @@ -34,7 +34,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
> > > >    len = strlen(tmp) + 1;
> > > >    board_type = devm_kzalloc(dev, len, GFP_KERNEL);
> > > >    strscpy(board_type, tmp, len);
> > > > - for (i = 0; i < board_type[i]; i++) {
> > > > + for (i = 0; i < len; i++) {
> > > >    if (board_type[i] == '/')
> > > >    board_type[i] = '-';
> > > >    }
> > >
> > > It should probably just use strreplace() though :)
> >
> > Good point. I'll send a v2.
> >
>
> and the 2 lines above look like a devm_kstrdup.
>
> The (unlikely) malloc failure test is also missing.

How many issues can you have in 6 lines of code ;-)

johannes