Message ID | 20240813115334.3922580-2-ruanjinjie@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kprobes: Annotate structs with __counted_by() | expand |
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) \
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 <ruanjinjie@huawei.com> --- kernel/kprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)