scsi: lpfc: Fix miss of register read failure check
authorJames Smart <jsmart2021@gmail.com>
Sun, 22 Sep 2019 03:58:49 +0000 (20:58 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 1 Oct 2019 02:07:08 +0000 (22:07 -0400)
Coverity flagged missing status check on register read that flags a
poisoned data return value.

Add checking of register read status.

Link: https://lore.kernel.org/r/20190922035906.10977-4-jsmart2021@gmail.com
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_attr.c

index 25aa7a5..41cc91d 100644 (file)
@@ -1475,8 +1475,9 @@ lpfc_sli4_pdev_status_reg_wait(struct lpfc_hba *phba)
        int i;
 
        msleep(100);
-       lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr,
-                  &portstat_reg.word0);
+       if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr,
+                      &portstat_reg.word0))
+               return -EIO;
 
        /* verify if privileged for the request operation */
        if (!bf_get(lpfc_sliport_status_rn, &portstat_reg) &&
@@ -1486,8 +1487,9 @@ lpfc_sli4_pdev_status_reg_wait(struct lpfc_hba *phba)
        /* wait for the SLI port firmware ready after firmware reset */
        for (i = 0; i < LPFC_FW_RESET_MAXIMUM_WAIT_10MS_CNT; i++) {
                msleep(10);
-               lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr,
-                          &portstat_reg.word0);
+               if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr,
+                              &portstat_reg.word0))
+                       continue;
                if (!bf_get(lpfc_sliport_status_err, &portstat_reg))
                        continue;
                if (!bf_get(lpfc_sliport_status_rn, &portstat_reg))