]> Git Repo - linux.git/commitdiff
hpet: Replace one-element array with flexible-array member
authorKees Cook <[email protected]>
Fri, 18 Nov 2022 03:42:55 +0000 (19:42 -0800)
committerKees Cook <[email protected]>
Fri, 2 Dec 2022 21:10:36 +0000 (13:10 -0800)
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

Cc: Clemens Ladisch <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
include/linux/hpet.h

index 8604564b985dcaf36ee4cca2bdbbdcc025d4f5d1..21e69eaf7a36d052fd0e2807cb92525a77d993f7 100644 (file)
@@ -30,7 +30,7 @@ struct hpet {
                        unsigned long _hpet_compare;
                } _u1;
                u64 hpet_fsb[2];        /* FSB route */
-       } hpet_timers[1];
+       } hpet_timers[];
 };
 
 #define        hpet_mc         _u0._hpet_mc
This page took 0.057287 seconds and 4 git commands to generate.