@@ -1942,14 +1942,16 @@ struct nvram_81xx {
__le16 reserved_6[24];
/* Offset 128. */
- __le16 ex_version;
- uint8_t prio_fcf_matching_flags;
- uint8_t reserved_6_1[3];
- __le16 pri_fcf_vlan_id;
- uint8_t pri_fcf_fabric_name[8];
- __le16 reserved_6_2[7];
- uint8_t spma_mac_addr[6];
- __le16 reserved_6_3[14];
+ struct_group(ex_cb_81xx,
+ __le16 ex_version;
+ uint8_t prio_fcf_matching_flags;
+ uint8_t reserved_6_1[3];
+ __le16 pri_fcf_vlan_id;
+ uint8_t pri_fcf_fabric_name[8];
+ __le16 reserved_6_2[7];
+ uint8_t spma_mac_addr[6];
+ __le16 reserved_6_3[14];
+ );
/* Offset 192. */
uint8_t min_supported_speed;
@@ -9187,7 +9187,7 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
}
/* Use extended-initialization control block. */
- memcpy(ha->ex_init_cb, &nv->ex_version, sizeof(*ha->ex_init_cb));
+ memcpy(ha->ex_init_cb, &nv->ex_cb_81xx, sizeof(*ha->ex_init_cb));
ha->frame_payload_size = le16_to_cpu(icb->frame_payload_size);
/*
* Setup driver NVRAM options.
When compiling with gcc version 14.0.0 20240108 (experimental) and CONFIG_FORTIFY_SOURCE=y, I've noticed the following warning: In function 'fortify_memcpy_chk', inlined from 'qla81xx_nvram_config' at drivers/scsi/qla2xxx/qla_init.c:9190:2: ./include/linux/fortify-string.h:588:25: warning: call to '__read_overflow2_field' declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Wattribute-warning] 588 | __read_overflow2_field(q_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This call to 'memcpy()' is interpreted as an attempt to copy 'sizeof(struct ex_init_cb_81xx)' bytes from 2-byte 'ex_version' field of 'struct nvram_81xx' and thus overread warning is issued. Since we actually want to copy the whole control block in 81xx format, use the convenient 'struct_group' for the latter. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> --- drivers/scsi/qla2xxx/qla_fw.h | 18 ++++++++++-------- drivers/scsi/qla2xxx/qla_init.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-)