[PATCH 009/117] iscsi: Add a compile-time structure size check

Bart Van Assche
2021-04-20T00:09:05Z

Before modifying the struct iscsi_bsg_reply definition, add a compile-time
structure size check.

Cc: Lee Duncan <lduncan@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/scsi/scsi_transport_iscsi.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index bebfb355abdf..4f821118ea23 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -4729,6 +4729,9 @@ static __init int iscsi_transport_init(void)
.groups = 1,
.input = iscsi_if_rx,
};
+
+ BUILD_BUG_ON(offsetof(struct iscsi_bsg_reply, reply_data) != 8);
+
printk(KERN_INFO "Loading iSCSI transport class v%s.\n",
ISCSI_TRANSPORT_VERSION);