[PATCH v3] scsi: qla2xxx: Fix flex array member not at end

Jesse Taube posted 1 patch 2 hours ago
drivers/scsi/qla2xxx/qla_edif_bsg.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH v3] scsi: qla2xxx: Fix flex array member not at end
Posted by Jesse Taube 2 hours ago
In qla_edif_bsg.h: `struct fc_bsg_reply` and `struct fc_bsg_request`
have flexible array members, thus they must be the last member of
the parent structure. Contininging in the effort to add
`-Wflex-array-member-not-at-end`, put `struct fc_bsg_*` inside a
union with the trailing members padded to the size of `struct fc_bsg_*`
to silence the warning. This is similar to TRAILING_OVERLAP, exept
that the position of the flexible array member is also in a union,
causing it to not be the last member of the structure.

Suggested-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Jesse Taube <jtaubepe@redhat.com>
---
V1 -> V2:
 - Rewrite
V2 -> V3:
 - Fix commit description
---
 drivers/scsi/qla2xxx/qla_edif_bsg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_edif_bsg.h b/drivers/scsi/qla2xxx/qla_edif_bsg.h
index 514c265ba86e..bcc35d149c1f 100644
--- a/drivers/scsi/qla2xxx/qla_edif_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_edif_bsg.h
@@ -36,16 +36,16 @@ struct extra_auth_els {
 } __packed;
 
 struct qla_bsg_auth_els_request {
-	struct fc_bsg_request r;
 	struct extra_auth_els e;
+	struct fc_bsg_request r;
 };
 
 struct qla_bsg_auth_els_reply {
-	struct fc_bsg_reply r;
 	uint32_t rx_xchg_address;
 	uint8_t version;
 	uint8_t pad[VND_CMD_PAD_SIZE];
 	uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
+	struct fc_bsg_reply r;
 };
 
 struct app_id {
-- 
2.54.0