aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Smart <jsmart2021@gmail.com>2017-03-04 12:30:22 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2017-03-06 23:04:22 -0500
commit7aabe84b8a1bb7c3f75fb6a23dc96f8999bdcc8f (patch)
treec33a898cf065f3ed2c6d72b0c836c0416caeea6d
parent70e5afd57d6d97d69bf5fd0187c2bb5a79990504 (diff)
scsi: lpfc: sanity check hrq is null before dereferencing it
From: Colin Ian King <colin.king@canonical.com> The sanity check for hrq should be moved to before the deference of hrq to ensure we don't perform a null pointer deference. Detected by CoverityScan, CID#1411650 ("Dereference before null check") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index d8d8693040ac..562a5286bc47 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -15185,17 +15185,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp,
15185 drq = drqp[idx]; 15185 drq = drqp[idx];
15186 cq = cqp[idx]; 15186 cq = cqp[idx];
15187 15187
15188 if (hrq->entry_count != drq->entry_count) {
15189 status = -EINVAL;
15190 goto out;
15191 }
15192
15193 /* sanity check on queue memory */ 15188 /* sanity check on queue memory */
15194 if (!hrq || !drq || !cq) { 15189 if (!hrq || !drq || !cq) {
15195 status = -ENODEV; 15190 status = -ENODEV;
15196 goto out; 15191 goto out;
15197 } 15192 }
15198 15193
15194 if (hrq->entry_count != drq->entry_count) {
15195 status = -EINVAL;
15196 goto out;
15197 }
15198
15199 if (idx == 0) { 15199 if (idx == 0) {
15200 bf_set(lpfc_mbx_rq_create_num_pages, 15200 bf_set(lpfc_mbx_rq_create_num_pages,
15201 &rq_create->u.request, 15201 &rq_create->u.request,