History

hpet: Replace one-element array with flexible-array member

One-element arrays are deprecated[1] and are being replaced with flexible array members in support of the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. Replace one-element array with flexible-array member in struct hpet. This results in no differences in binary output. The use of struct hpet is never used with sizeof() and accesses via hpet_timers array are already done after explicit bounds checking. [1] https://github.com/KSPP/linux/issues/79

Kees Cook committed 3 years ago

Commit d6621981 parent bdc77501 file · +1 −1Browse files

Unified · Split

include/linux/hpet.h+1−1
@@ -30,7 +30,7 @@ struct hpet { · 29 unmodified lines
3030 unsigned long _hpet_compare;
3131 } _u1;
3232 u64 hpet_fsb[2]; /* FSB route */
33− } hpet_timers[1];
33+ } hpet_timers[];
3434 };
3535
3636 #define hpet_mc _u0._hpet_mc