Kernel-Janitors Archive mirror
 help / color / mirror / Atom feed
From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-hardening@vger.kernel.org"
	<linux-hardening@vger.kernel.org>
Subject: RE: [PATCH] RDMA/irdma: Annotate  flexible array with __counted_by() in struct irdma_qvlist_info
Date: Mon, 20 May 2024 15:02:01 +0000	[thread overview]
Message-ID: <IA1PR11MB7317A294F4AAFFBE7263EA6CE9E92@IA1PR11MB7317.namprd11.prod.outlook.com> (raw)
In-Reply-To: <2ca8b14adf79c4795d7aa95bbfc79253a6bfed82.1716102112.git.christophe.jaillet@wanadoo.fr>

> 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>

  reply	other threads:[~2024-05-20 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-05-30 12:16 ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=IA1PR11MB7317A294F4AAFFBE7263EA6CE9E92@IA1PR11MB7317.namprd11.prod.outlook.com \
    --to=shiraz.saleem@intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gustavoars@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=keescook@chromium.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).