public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hv: hyperv.h: Annotate vmbus_channel_gpadl_header with __counted_by()
@ 2024-10-15 10:18 Thorsten Blum
  2024-10-16  4:16 ` kernel test robot
  2024-12-07  7:48 ` Wei Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Blum @ 2024-10-15 10:18 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Kees Cook,
	Gustavo A. R. Silva
  Cc: Thorsten Blum, linux-hyperv, linux-kernel, linux-hardening

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@linux.dev>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-09  0:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 10:18 [PATCH] hv: hyperv.h: Annotate vmbus_channel_gpadl_header with __counted_by() Thorsten Blum
2024-10-16  4:16 ` kernel test robot
2024-12-07  7:48 ` Wei Liu
2024-12-09  0:16   ` Thorsten Blum
2024-12-09  0:46     ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox