From: Wei Yongjun Date: Sun, 2 Dec 2012 13:33:24 +0000 (-0500) Subject: [SCSI] lpfc: fix potential NULL pointer dereference in lpfc_sli4_rq_put() X-Git-Tag: v3.9-rc7~14^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5a25bf36b7394f11f2ff90c9e203639cd3dc041a;p=profile%2Fivi%2Fkernel-x86-ivi.git [SCSI] lpfc: fix potential NULL pointer dereference in lpfc_sli4_rq_put() The dereference to 'put_index' should be moved below the NULL test. Signed-off-by: Wei Yongjun Acked-by: James Smart Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 74b67d9..d43faf3 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -438,11 +438,12 @@ lpfc_sli4_rq_put(struct lpfc_queue *hq, struct lpfc_queue *dq, struct lpfc_rqe *temp_hrqe; struct lpfc_rqe *temp_drqe; struct lpfc_register doorbell; - int put_index = hq->host_index; + int put_index; /* sanity check on queue memory */ if (unlikely(!hq) || unlikely(!dq)) return -ENOMEM; + put_index = hq->host_index; temp_hrqe = hq->qe[hq->host_index].rqe; temp_drqe = dq->qe[dq->host_index].rqe;