[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221118034250.never.999-kees@kernel.org>
Date: Thu, 17 Nov 2022 19:42:55 -0800
From: Kees Cook <keescook@...omium.org>
To: Clemens Ladisch <clemens@...isch.de>
Cc: Kees Cook <keescook@...omium.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: [PATCH] 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
Cc: Clemens Ladisch <clemens@...isch.de>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
Signed-off-by: Kees Cook <keescook@...omium.org>
---
include/linux/hpet.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 8604564b985d..21e69eaf7a36 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -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
--
2.34.1
Powered by blists - more mailing lists