Blame SOURCES/0093-scsi-scsi-qla2xxx-Check-the-size-of-firmware-data-st.patch

3c6e85
From a23950ba57e7e834f0ab5d689693e568e6ed29c9 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:55:53 -0400
3c6e85
Subject: [PATCH 093/124] [scsi] scsi: qla2xxx: Check the size of firmware data
3c6e85
 structures at compile time
3c6e85
3c6e85
Message-id: <20190801155618.12650-94-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267877
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 093/118] scsi: qla2xxx: Check the size of firmware data structures at compile time
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Bart Van Assche <bvanassche@acm.org>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
Since the next patch will modify several firmware data structures, add
3c6e85
compile time checks that verify that these structures have the correct
3c6e85
size.
3c6e85
3c6e85
Cc: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Cc: Giridhar Malavali <gmalavali@marvell.com>
3c6e85
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3c6e85
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit bc04459ce4e5d394d79fe2a0660d43c1a40b6eb8)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_os.c     | 24 ++++++++++++++++++++++++
3c6e85
 drivers/scsi/qla2xxx/qla_target.c |  3 +++
3c6e85
 2 files changed, 27 insertions(+)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
3c6e85
index bc72d4802844..bf0896af5ad3 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_os.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_os.c
3c6e85
@@ -7364,6 +7364,30 @@ qla2x00_module_init(void)
3c6e85
 {
3c6e85
 	int ret = 0;
3c6e85
 
3c6e85
+	BUILD_BUG_ON(sizeof(cmd_entry_t) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(cont_a64_entry_t) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(cont_entry_t) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(init_cb_t) != 96);
3c6e85
+	BUILD_BUG_ON(sizeof(ms_iocb_entry_t) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(request_t) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct access_chip_84xx) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_bidir) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_nvme) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_type_6) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_type_7) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_type_7_fx00) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct cmd_type_crc_2) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct ct_entry_24xx) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct ctio_crc2_to_fw) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct els_entry_24xx) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct fxdisc_entry_fx00) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct init_cb_24xx) != 128);
3c6e85
+	BUILD_BUG_ON(sizeof(struct init_cb_81xx) != 128);
3c6e85
+	BUILD_BUG_ON(sizeof(struct pt_ls4_request) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct sns_cmd_pkt) != 2064);
3c6e85
+	BUILD_BUG_ON(sizeof(struct verify_chip_entry_84xx) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct vf_evfp_entry_24xx) != 56);
3c6e85
+
3c6e85
 	/* Allocate cache for SRBs. */
3c6e85
 	srb_cachep = kmem_cache_create("qla2xxx_srbs", sizeof(srb_t), 0,
3c6e85
 	    SLAB_HWCACHE_ALIGN, NULL);
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
3c6e85
index 204004431c3f..398a8d6b4db6 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_target.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_target.c
3c6e85
@@ -7407,6 +7407,9 @@ int __init qlt_init(void)
3c6e85
 {
3c6e85
 	int ret;
3c6e85
 
3c6e85
+	BUILD_BUG_ON(sizeof(struct ctio7_to_24xx) != 64);
3c6e85
+	BUILD_BUG_ON(sizeof(struct ctio_to_2xxx) != 64);
3c6e85
+
3c6e85
 	if (!qlt_parse_ini_mode()) {
3c6e85
 		ql_log(ql_log_fatal, NULL, 0xe06b,
3c6e85
 		    "qlt_parse_ini_mode() failed\n");
3c6e85
-- 
3c6e85
2.13.6
3c6e85