scsi: aacraid: union aac_init: Replace 1-element array with flexible array
Subsystems (2)
PATCH 1/1 scsi: aacraid: union aac_init: Replace 1-element array with flexible array
Replace the deprecated[1] use of a 1-element array in union aac_init with a modern flexible array.
Additionally add __counted_by annotation since rrq is only ever accessed after rr_queue_count has been set (with the same value used to control the loop):
init->r8.rr_queue_count = cpu_to_le32(dev->max_msix);
...
for (i = 0; i < dev->max_msix; i++) {
addr = (u64)dev->host_rrq_pa + dev->vector_cap * i *
sizeof(u32);
init->r8.rrq[i].host_addr_high = cpu_to_le32(
upper_32_bits(addr));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/aacraid.h | 2 +- drivers/scsi/aacraid/src.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/aacraid.h +1 -1
@@ -873,7 +873,7 @@ union aac_init__le16 element_count;__le16 comp_thresh;__le16 unused; - } rrq[1 ];/* up to 64 RRQ addresses */ + } rrq[] __counted_by_le(rr_queue_count); /* up to 64 RRQ addresses */ } r8; };
drivers/scsi/aacraid/src.c +1 -1
@@ -410,7 +410,7 @@ static void aac_src_start_adapter(struct aac_dev *dev)lower_32_bits (dev->init_pa),upper_32_bits (dev->init_pa),sizeof (struct _r8 ) + - (AAC_MAX_HRRQ -1 ) *sizeof (struct _rrq ), +AAC_MAX_HRRQ *sizeof (struct _rrq ), 0, 0, 0, NULL, NULL, NULL, NULL, NULL); }else { init->r7.host_elapsed_seconds =
Signature · 1 line
2.34.1
Quoted 47 lines · Kees Cook
Replace the deprecated[1] use of a 1-element array in union
aac_initwith a modern flexible array.Additionally add
__counted_byannotation since rrq is only ever accessed afterrr_queue_counthas been set (with the same value used to control the loop):init->r8.rr_queue_count = cpu_to_le32(dev->max_msix); ... for (i = 0; i < dev->max_msix; i++) { addr = (u64)dev->host_rrq_pa + dev->vector_cap * i * sizeof(u32); init->r8.rrq[i].host_addr_high = cpu_to_le32( upper_32_bits(addr));No binary differences are present after this conversion.
Signed-off-by Kees Cook <[email protected]>---
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/aacraid.h | 2 +- drivers/scsi/aacraid/src.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/scsi/aacraid/aacraid.h +1
-1@@ -873,7 +873,7 @@ union aac_init__le16 element_count;__le16 comp_thresh;__le16 unused; - } rrq[1 ];/* up to 64 RRQ addresses */ + } rrq[] __counted_by_le(rr_queue_count); /* up to 64 RRQ addresses */ } r8; };drivers/scsi/aacraid/src.c +0
-0
drivers/scsi/aacraid/src.c static void aac_src_start_adapter(struct aac_dev *dev) · line 413
Quoted 5 lines
drivers/scsi/aacraid/src.c +1
-1@@ -410,7 +410,7 @@ static void aac_src_start_adapter(struct aac_dev *dev)lower_32_bits (dev->init_pa),upper_32_bits (dev->init_pa),sizeof (struct _r8 ) + - (AAC_MAX_HRRQ - 1) * sizeof(struct _rrq), + AAC_MAX_HRRQ * sizeof(struct _rrq),
struct_size_t() can be used here?
In any case:
Thanks
Signature · 1 line
Gustavo
Quoted 3 lines
drivers/scsi/aacraid/src.c +0
-00, 0, 0, NULL, NULL, NULL, NULL, NULL); }else { init->r7.host_elapsed_seconds =
Martin K. Petersen
AppliedKees,
Quoted 2 lines
Replace the deprecated[1] use of a 1-element array in union
aac_initwith a modern flexible array.
Applied to 6.12/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · Kees Cook
Replace the deprecated[1] use of a 1-element array in union
aac_initwith a modern flexible array.Additionally add
__counted_byannotation since rrq is only ever accessed afterrr_queue_counthas been set (with the same value used to control the loop):[...]
Applied to 6.12/scsi-queue, thanks!
[1/1] scsi: aacraid: union aac_init: Replace 1-element array with flexible array
https://git.kernel.org/mkp/scsi/c/575b9be63684
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering