History

scsi: mpi3mr: Replace 1-element array with flex-array

Nothing else defined MPI3_NVME_ENCAP_CMD_MAX, so the "command" buffer was being defined as a fake flexible array of size 1. Replace this with a proper flex array. Avoids this GCC 13 warning under -fstrict-flex-arrays=3: In function 'fortify_memset_chk', inlined from 'mpi3mr_build_nvme_sgl' at ../drivers/scsi/mpi3mr/mpi3mr_app.c:693:2, inlined from 'mpi3mr_bsg_process_mpt_cmds.constprop' at ../drivers/scsi/mpi3mr/mpi3mr_app.c:1214:8: ../include/linux/fortify-string.h:430:25: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning] 430 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Kees Cook committed 3 years ago

Commit c6f2e6b1 parent ee4e7df1 file · +1 −7Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/scsi/scsi_bsg_mpi3mr.h+1−7
@@ -455,12 +455,6 @@ struct mpi3mr_bsg_packet { · 454 unmodified lines
455455 } cmd;
456456 };
457457
458−
459−/* MPI3: NVMe Encasulation related definitions */
460−#ifndef MPI3_NVME_ENCAP_CMD_MAX
461−#define MPI3_NVME_ENCAP_CMD_MAX (1)
462−#endif
463−
464458 struct mpi3_nvme_encapsulated_request {
465459 __le16 host_tag;
466460 __u8 ioc_use_only02;
@@ -474,7 +468,7 @@ struct mpi3_nvme_encapsulated_request { · 7 unmodified lines
474468 __le16 flags;
475469 __le32 data_length;
476470 __le32 reserved14[3];
477− __le32 command[MPI3_NVME_ENCAP_CMD_MAX];
471+ __le32 command[];
478472 };
479473
480474 struct mpi3_nvme_encapsulated_error_reply {