Linux Hardening
 help / color / mirror / Atom feed
* [PATCH] RDMA/irdma: Annotate  flexible array with __counted_by() in struct irdma_qvlist_info
@ 2024-05-19  7:02 Christophe JAILLET
  2024-05-20 15:02 ` Saleem, Shiraz
  2024-05-30 12:16 ` Leon Romanovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-05-19  7:02 UTC (permalink / raw)
  To: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Leon Romanovsky,
	Kees Cook, Gustavo A. R. Silva
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-rdma,
	linux-hardening

'num_vectors' is used to count the number of elements in the 'qv_info'
flexible array in "struct irdma_qvlist_info".

So annotate it with __counted_by() to make it explicit and enable some
additional checks.

This allocation is done in irdma_save_msix_info().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/infiniband/hw/irdma/main.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/irdma/main.h b/drivers/infiniband/hw/irdma/main.h
index b65bc2ea542f..9f0ed6e84471 100644
--- a/drivers/infiniband/hw/irdma/main.h
+++ b/drivers/infiniband/hw/irdma/main.h
@@ -239,7 +239,7 @@ struct irdma_qv_info {
 
 struct irdma_qvlist_info {
 	u32 num_vectors;
-	struct irdma_qv_info qv_info[];
+	struct irdma_qv_info qv_info[] __counted_by(num_vectors);
 };
 
 struct irdma_gen_ops {
-- 
2.45.1


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

end of thread, other threads:[~2024-05-30 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-19  7:02 [PATCH] RDMA/irdma: Annotate flexible array with __counted_by() in struct irdma_qvlist_info Christophe JAILLET
2024-05-20 15:02 ` Saleem, Shiraz
2024-05-30 12:16 ` Leon Romanovsky

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