[SCSI] qla4xxx: Correct the validation to check in get_sys_info mailbox
authorNilesh Javali <[email protected]>
Sat, 29 Dec 2012 07:24:53 +0000 (02:24 -0500)
committerJames Bottomley <[email protected]>
Wed, 30 Jan 2013 00:48:55 +0000 (11:48 +1100)
Check mbox_sts[3] instead of mbox_sts[4] for ISP83xx to validate size
of data returned

Signed-off-by: Nilesh Javali <[email protected]>
Signed-off-by: Vikas Chaudhary <[email protected]>
Reviewed-by: Mike Christie <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
drivers/scsi/qla4xxx/ql4_nx.c

index 491668d439a249adf33ba380516543c4d4deda1f..b3d6dabdc6f4a3d7e465a701d456d39a544208e8 100644 (file)
@@ -3427,11 +3427,11 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)
        }
 
        /* Make sure we receive the minimum required data to cache internally */
-       if (mbox_sts[4] < offsetof(struct mbx_sys_info, reserved)) {
+       if ((is_qla8032(ha) ? mbox_sts[3] : mbox_sts[4]) <
+           offsetof(struct mbx_sys_info, reserved)) {
                DEBUG2(printk("scsi%ld: %s: GET_SYS_INFO data receive"
                    " error (%x)\n", ha->host_no, __func__, mbox_sts[4]));
                goto exit_validate_mac82;
-
        }
 
        /* Save M.A.C. address & serial_number */