* [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
@ 2024-07-11 17:50 Kees Cook
2024-07-11 18:01 ` Gustavo A. R. Silva
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kees Cook @ 2024-07-11 17:50 UTC (permalink / raw)
To: Adaptec OEM Raid Solutions
Cc: Kees Cook, James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, linux-hardening
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);
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 */
};
/*
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
2024-07-11 17:50 [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array Kees Cook
@ 2024-07-11 18:01 ` Gustavo A. R. Silva
2024-08-03 1:29 ` Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2024-07-11 18:01 UTC (permalink / raw)
To: Kees Cook, Adaptec OEM Raid Solutions
Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
linux-kernel, linux-hardening
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 */
> };
>
> /*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
2024-07-11 17:50 [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array Kees Cook
2024-07-11 18:01 ` Gustavo A. R. Silva
@ 2024-08-03 1:29 ` Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2024-08-03 1:29 UTC (permalink / raw)
To: Kees Cook
Cc: Adaptec OEM Raid Solutions, James E.J. Bottomley,
Martin K. Petersen, linux-scsi, linux-kernel, linux-hardening
Kees,
> Replace the deprecated[1] use of a 1-element array in struct
> aac_ciss_phys_luns_resp with a modern flexible array.
Applied to 6.12/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
2024-07-11 17:50 [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array Kees Cook
2024-07-11 18:01 ` Gustavo A. R. Silva
2024-08-03 1:29 ` Martin K. Petersen
@ 2024-08-05 21:17 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2024-08-05 21:17 UTC (permalink / raw)
To: Adaptec OEM Raid Solutions, Kees Cook
Cc: Martin K . Petersen, James E.J. Bottomley, linux-scsi,
linux-kernel, linux-hardening
On Thu, 11 Jul 2024 10:50:55 -0700, 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.
>
>
Applied to 6.12/scsi-queue, thanks!
[1/1] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array
https://git.kernel.org/mkp/scsi/c/2e35b43bc9a8
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-05 21:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11 17:50 [PATCH] scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array Kees Cook
2024-07-11 18:01 ` Gustavo A. R. Silva
2024-08-03 1:29 ` Martin K. Petersen
2024-08-05 21:17 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.