Skip to content

Commit 575b9be

Browse files
keesmartinkpetersen
authored andcommitted
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. Link: KSPP#79 [1] Signed-off-by: Kees Cook <kees@kernel.org> Link: https://lore.kernel.org/r/20240711174815.work.689-kees@kernel.org Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 29b4a49 commit 575b9be

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ union aac_init
873873
__le16 element_count;
874874
__le16 comp_thresh;
875875
__le16 unused;
876-
} rrq[1]; /* up to 64 RRQ addresses */
876+
} rrq[] __counted_by_le(rr_queue_count); /* up to 64 RRQ addresses */
877877
} r8;
878878
};
879879

drivers/scsi/aacraid/src.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static void aac_src_start_adapter(struct aac_dev *dev)
410410
lower_32_bits(dev->init_pa),
411411
upper_32_bits(dev->init_pa),
412412
sizeof(struct _r8) +
413-
(AAC_MAX_HRRQ - 1) * sizeof(struct _rrq),
413+
AAC_MAX_HRRQ * sizeof(struct _rrq),
414414
0, 0, 0, NULL, NULL, NULL, NULL, NULL);
415415
} else {
416416
init->r7.host_elapsed_seconds =

0 commit comments

Comments
 (0)