Skip to contentSkip to conversation

scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array

PATCH Applied Kees Cook 3 participants 4 messages Jul 11, 2024 – Aug 5, 2024

Subsystems (2)
lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 scsi: aacraid: struct aac_ciss_phys_luns_resp: Replace 1-element array with flexible array

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.

---
Cc: Adaptec OEM Raid Solutions <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: [email protected]

---
 drivers/scsi/aacraid/aachba.c  | 2 +-
 drivers/scsi/aacraid/aacraid.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/aachba.c +1 -1
index b22857c6f3f4..497c6dd5df91 100644
@@ -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;
drivers/scsi/aacraid/aacraid.h +1 -1
index 659e393c1033..6f0417f6f8a1 100644
@@ -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 */
 };
 
 /*
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Kees Cook

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.

---
Cc: Adaptec OEM Raid Solutions <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: [email protected]

---
  drivers/scsi/aacraid/aachba.c  | 2 +-
  drivers/scsi/aacraid/aacraid.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/aachba.c +0 -0
index b22857c6f3f4..497c6dd5df91 100644

drivers/scsi/aacraid/aachba.c static int aac_get_safw_ciss_luns(struct aac_dev *dev) · line 1836

Quoted 5 lines
drivers/scsi/aacraid/aachba.c +1 -1
@@ -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:

Thanks

Signature · 1 line
Gustavo
Quoted 16 lines
drivers/scsi/aacraid/aachba.c +0 -0
  	phys_luns = kmalloc(datasize, GFP_KERNEL);
  	if (phys_luns == NULL)
  		goto out;
drivers/scsi/aacraid/aacraid.h +1 -1
index 659e393c1033..6f0417f6f8a1 100644
@@ -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 lore raw
In reply to Kees Cook

Kees,

Quoted 2 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Kees Cook
Quoted 6 lines · Kees Cook

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering