[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e94bc51-f699-406b-9522-1386d1b8f58f@embeddedor.com>
Date: Thu, 11 Jul 2024 12:01:02 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Kees Cook <kees@...nel.org>,
Adaptec OEM Raid Solutions <aacraid@...rosemi.com>
Cc: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace
1-element array with flexible array
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@...nel.org>
> ---
> Cc: Adaptec OEM Raid Solutions <aacraid@...rosemi.com>
> Cc: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>
> Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
> Cc: linux-scsi@...r.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@...nel.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 */
> };
>
> /*
Powered by blists - more mailing lists