[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <169676055888.3135.18089597086363215333.tip-bot2@tip-bot2>
Date: Sun, 08 Oct 2023 10:22:38 -0000
From: "tip-bot2 for Kees Cook" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Kees Cook <keescook@...omium.org>, Ingo Molnar <mingo@...nel.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: perf/core] perf/x86/rapl: Annotate 'struct rapl_pmus' with __counted_by
The following commit has been merged into the perf/core branch of tip:
Commit-ID: a56d5551e1993ca84dd0c69df5a3d8223d13fb5f
Gitweb: https://git.kernel.org/tip/a56d5551e1993ca84dd0c69df5a3d8223d13fb5f
Author: Kees Cook <keescook@...omium.org>
AuthorDate: Fri, 06 Oct 2023 13:17:54 -07:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Sun, 08 Oct 2023 12:18:17 +02:00
perf/x86/rapl: Annotate 'struct rapl_pmus' with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS=y (for
array indexing) and CONFIG_FORTIFY_SOURCE=y (for strcpy/memcpy-family
functions).
Found with Coccinelle:
https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1]
Add __counted_by for 'struct rapl_pmus'.
No change in functionality intended.
Signed-off-by: Kees Cook <keescook@...omium.org>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Link: https://lore.kernel.org/r/20231006201754.work.473-kees@kernel.org
---
arch/x86/events/rapl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c
index c2c37fb..8d98d46 100644
--- a/arch/x86/events/rapl.c
+++ b/arch/x86/events/rapl.c
@@ -115,7 +115,7 @@ struct rapl_pmu {
struct rapl_pmus {
struct pmu pmu;
unsigned int maxdie;
- struct rapl_pmu *pmus[];
+ struct rapl_pmu *pmus[] __counted_by(maxdie);
};
enum rapl_unit_quirk {
Powered by blists - more mailing lists