[PATCH] hv: hyperv.h: Annotate vmbus_channel_gpadl_header with __counted_by()
From: Thorsten Blum
Date: Tue Oct 15 2024 - 06:19:24 EST
Add the __counted_by compiler attribute to the flexible array member
range to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.
Compile-tested only.
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
include/linux/hyperv.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 22c22fb91042..ec62d625c439 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -643,7 +643,7 @@ struct vmbus_channel_gpadl_header {
u32 gpadl;
u16 range_buflen;
u16 rangecount;
- struct gpa_range range[];
+ struct gpa_range range[] __counted_by(rangecount);
} __packed;
/* This is the followup packet that contains more PFNs. */
--
2.47.0