mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Kees Cook <kees@kernel.org>,
	Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
Date: Thu, 11 Jul 2024 12:01:02 -0600	[thread overview]
Message-ID: <4e94bc51-f699-406b-9522-1386d1b8f58f@embeddedor.com> (raw)
In-Reply-To: <20240711175055.work.928-kees@kernel.org>



On 11/07/24 11:50, Kees Cook wrote:
> Replace the deprecated[1] use of a 1-element array in
> struct aac_ciss_phys_luns_resp with a modern flexible array.
> 
> No binary differences are present after this conversion.
> 
> Link: https://github.com/KSPP/linux/issues/79 [1]
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
> Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: linux-scsi@vger.kernel.org
> ---
>   drivers/scsi/aacraid/aachba.c  | 2 +-
>   drivers/scsi/aacraid/aacraid.h | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
> index b22857c6f3f4..497c6dd5df91 100644
> --- a/drivers/scsi/aacraid/aachba.c
> +++ b/drivers/scsi/aacraid/aachba.c
> @@ -1833,7 +1833,7 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev)
>   	struct aac_ciss_phys_luns_resp *phys_luns;
>   
>   	datasize = sizeof(struct aac_ciss_phys_luns_resp) +
> -		(AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
> +		AAC_MAX_TARGETS * sizeof(struct _ciss_lun);

I think this is a good candidate for struct_size().

In any case:

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-- 
Gustavo

>   	phys_luns = kmalloc(datasize, GFP_KERNEL);
>   	if (phys_luns == NULL)
>   		goto out;
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index 659e393c1033..6f0417f6f8a1 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -322,7 +322,7 @@ struct aac_ciss_phys_luns_resp {
>   		u8	level3[2];
>   		u8	level2[2];
>   		u8	node_ident[16];	/* phys. node identifier */
> -	} lun[1];			/* List of phys. devices */
> +	} lun[];			/* List of phys. devices */
>   };
>   
>   /*

  reply	other threads:[~2024-07-11 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11 17:50 Kees Cook
2024-07-11 18:01 ` Gustavo A. R. Silva [this message]
2024-08-03  1:29 ` Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen

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=4e94bc51-f699-406b-9522-1386d1b8f58f@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=aacraid@microsemi.com \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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

all inboxes | Powered by JetHome®