* [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* RE: [PATCH] RDMA/irdma: Annotate flexible array with __counted_by() in struct irdma_qvlist_info
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
1 sibling, 0 replies; 3+ messages in thread
From: Saleem, Shiraz @ 2024-05-20 15:02 UTC (permalink / raw)
To: Christophe JAILLET, Ismail, Mustafa, Jason Gunthorpe,
Leon Romanovsky, Kees Cook, Gustavo A. R. Silva
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-rdma@vger.kernel.org, linux-hardening@vger.kernel.org
> Subject: [PATCH] RDMA/irdma: Annotate flexible array with __counted_by() in
> struct irdma_qvlist_info
>
> '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);
> };
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] RDMA/irdma: Annotate flexible array with __counted_by() in struct irdma_qvlist_info
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
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2024-05-30 12:16 UTC (permalink / raw)
To: Mustafa Ismail, Shiraz Saleem, Jason Gunthorpe, Kees Cook,
Gustavo A. R. Silva, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, linux-rdma, linux-hardening
On Sun, 19 May 2024 09:02:15 +0200, Christophe JAILLET wrote:
> '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().
>
> [...]
Applied, thanks!
[1/1] RDMA/irdma: Annotate flexible array with __counted_by() in struct irdma_qvlist_info
https://git.kernel.org/rdma/rdma/c/38c02d813aa321
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [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