Re: [PATCH] cfg80211: Fix array-bounds warning in fragment copy
From: Johannes Berg
Date: Mon Mar 27 2017 - 07:38:50 EST
> > > - const skb_frag_t *frag = &sh->frags[-1];
> > > + const skb_frag_t *frag = &sh->frags[0];
[...]
> > > + frag--;
> >
> > Isn't it just a question of time until the compiler will see
> > through this trick and warn about it?
>
> Frag is incremented again before being accessed, so there is nothing
> for the compiler to see through here.
But by that argument the existing code was already fine. The compiler
flagged it nonetheless, perhaps because it couldn't prove it was
incremented unconditionally/in all branches?
johannes