Add the __counted_by compiler attribute to the flexible array member stripes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
Signed-off-by: Jinjie Ruan <[email protected]> --- kernel/kprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index da59c68df841..e6f7b0d3b29c 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -92,7 +92,7 @@ struct kprobe_insn_page { struct kprobe_insn_cache *cache; int nused; int ngarbage; - char slot_used[]; + char slot_used[] __counted_by(nused); }; #define KPROBE_INSN_PAGE_SIZE(slots) \ -- 2.34.1
