Re: [PATCH] cfg80211: Fix array-bounds warning in fragment copy

2017-03-27 Thread Matthias Kaehlcke
El Mon, Mar 27, 2017 at 12:47:59PM +0200 Johannes Berg ha dit: > On Fri, 2017-03-24 at 18:06 -0700, Matthias Kaehlcke wrote: > > __ieee80211_amsdu_copy_frag intentionally initializes a pointer to > > array[-1] to increment it later to valid values. clang rightfully > > generates an array-bounds

Re: [PATCH] cfg80211: Fix array-bounds warning in fragment copy

2017-03-27 Thread Johannes Berg
> > > - const skb_frag_t *frag = >frags[-1]; > > > + const skb_frag_t *frag = >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

Re: [PATCH] cfg80211: Fix array-bounds warning in fragment copy

2017-03-27 Thread Felix Fietkau
On 2017-03-27 12:47, Johannes Berg wrote: > On Fri, 2017-03-24 at 18:06 -0700, Matthias Kaehlcke wrote: >> __ieee80211_amsdu_copy_frag intentionally initializes a pointer to >> array[-1] to increment it later to valid values. clang rightfully >> generates an array-bounds warning on the

Re: [PATCH] cfg80211: Fix array-bounds warning in fragment copy

2017-03-27 Thread Johannes Berg
On Fri, 2017-03-24 at 18:06 -0700, Matthias Kaehlcke wrote: > __ieee80211_amsdu_copy_frag intentionally initializes a pointer to > array[-1] to increment it later to valid values. clang rightfully > generates an array-bounds warning on the initialization statement. > Work around this by

[PATCH] cfg80211: Fix array-bounds warning in fragment copy

2017-03-24 Thread Matthias Kaehlcke
__ieee80211_amsdu_copy_frag intentionally initializes a pointer to array[-1] to increment it later to valid values. clang rightfully generates an array-bounds warning on the initialization statement. Work around this by initializing the pointer to array[0] and decrementing it later, which allows