diff options
author | James Smart <james.smart@emulex.com> | 2014-09-03 12:58:06 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-09-16 12:10:12 -0400 |
commit | eb01656688edd686a80c89281043fe6f2b2af6ff (patch) | |
tree | 05c006d396d767af928a2fe27241238077ae796a /drivers/scsi/lpfc/lpfc_sli.c | |
parent | a2fc4aefa06d8b57b6728c1787c84fb3d3c86354 (diff) |
lpfc: fix low priority issues from fortify source code scan
Fixed Low priority issues from lpfc given by fortify source code scan.
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 2c7057fa2adb..cea89c6ce1d6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -187,7 +187,6 @@ lpfc_sli4_mq_put(struct lpfc_queue *q, struct lpfc_mqe *mqe) | |||
187 | { | 187 | { |
188 | struct lpfc_mqe *temp_mqe; | 188 | struct lpfc_mqe *temp_mqe; |
189 | struct lpfc_register doorbell; | 189 | struct lpfc_register doorbell; |
190 | uint32_t host_index; | ||
191 | 190 | ||
192 | /* sanity check on queue memory */ | 191 | /* sanity check on queue memory */ |
193 | if (unlikely(!q)) | 192 | if (unlikely(!q)) |
@@ -202,7 +201,6 @@ lpfc_sli4_mq_put(struct lpfc_queue *q, struct lpfc_mqe *mqe) | |||
202 | q->phba->mbox = (MAILBOX_t *)temp_mqe; | 201 | q->phba->mbox = (MAILBOX_t *)temp_mqe; |
203 | 202 | ||
204 | /* Update the host index before invoking device */ | 203 | /* Update the host index before invoking device */ |
205 | host_index = q->host_index; | ||
206 | q->host_index = ((q->host_index + 1) % q->entry_count); | 204 | q->host_index = ((q->host_index + 1) % q->entry_count); |
207 | 205 | ||
208 | /* Ring Doorbell */ | 206 | /* Ring Doorbell */ |
@@ -2435,11 +2433,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
2435 | IOCB_t * irsp; | 2433 | IOCB_t * irsp; |
2436 | WORD5 * w5p; | 2434 | WORD5 * w5p; |
2437 | uint32_t Rctl, Type; | 2435 | uint32_t Rctl, Type; |
2438 | uint32_t match; | ||
2439 | struct lpfc_iocbq *iocbq; | 2436 | struct lpfc_iocbq *iocbq; |
2440 | struct lpfc_dmabuf *dmzbuf; | 2437 | struct lpfc_dmabuf *dmzbuf; |
2441 | 2438 | ||
2442 | match = 0; | ||
2443 | irsp = &(saveq->iocb); | 2439 | irsp = &(saveq->iocb); |
2444 | 2440 | ||
2445 | if (irsp->ulpCommand == CMD_ASYNC_STATUS) { | 2441 | if (irsp->ulpCommand == CMD_ASYNC_STATUS) { |
@@ -2865,7 +2861,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
2865 | void lpfc_poll_eratt(unsigned long ptr) | 2861 | void lpfc_poll_eratt(unsigned long ptr) |
2866 | { | 2862 | { |
2867 | struct lpfc_hba *phba; | 2863 | struct lpfc_hba *phba; |
2868 | uint32_t eratt = 0, rem; | 2864 | uint32_t eratt = 0; |
2869 | uint64_t sli_intr, cnt; | 2865 | uint64_t sli_intr, cnt; |
2870 | 2866 | ||
2871 | phba = (struct lpfc_hba *)ptr; | 2867 | phba = (struct lpfc_hba *)ptr; |
@@ -2880,7 +2876,7 @@ void lpfc_poll_eratt(unsigned long ptr) | |||
2880 | cnt = (sli_intr - phba->sli.slistat.sli_prev_intr); | 2876 | cnt = (sli_intr - phba->sli.slistat.sli_prev_intr); |
2881 | 2877 | ||
2882 | /* 64-bit integer division not supporte on 32-bit x86 - use do_div */ | 2878 | /* 64-bit integer division not supporte on 32-bit x86 - use do_div */ |
2883 | rem = do_div(cnt, LPFC_ERATT_POLL_INTERVAL); | 2879 | do_div(cnt, LPFC_ERATT_POLL_INTERVAL); |
2884 | phba->sli.slistat.sli_ips = cnt; | 2880 | phba->sli.slistat.sli_ips = cnt; |
2885 | 2881 | ||
2886 | phba->sli.slistat.sli_prev_intr = sli_intr; | 2882 | phba->sli.slistat.sli_prev_intr = sli_intr; |
@@ -5953,9 +5949,6 @@ lpfc_sli4_get_allocated_extnts(struct lpfc_hba *phba, uint16_t type, | |||
5953 | curr_blks++; | 5949 | curr_blks++; |
5954 | } | 5950 | } |
5955 | 5951 | ||
5956 | /* Calculate the total requested length of the dma memory. */ | ||
5957 | req_len = curr_blks * sizeof(uint16_t); | ||
5958 | |||
5959 | /* | 5952 | /* |
5960 | * Calculate the size of an embedded mailbox. The uint32_t | 5953 | * Calculate the size of an embedded mailbox. The uint32_t |
5961 | * accounts for extents-specific word. | 5954 | * accounts for extents-specific word. |
@@ -6766,13 +6759,16 @@ void | |||
6766 | lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | 6759 | lpfc_mbox_timeout_handler(struct lpfc_hba *phba) |
6767 | { | 6760 | { |
6768 | LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; | 6761 | LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active; |
6769 | MAILBOX_t *mb = &pmbox->u.mb; | 6762 | MAILBOX_t *mb = NULL; |
6763 | |||
6770 | struct lpfc_sli *psli = &phba->sli; | 6764 | struct lpfc_sli *psli = &phba->sli; |
6771 | 6765 | ||
6772 | /* If the mailbox completed, process the completion and return */ | 6766 | /* If the mailbox completed, process the completion and return */ |
6773 | if (lpfc_sli4_process_missed_mbox_completions(phba)) | 6767 | if (lpfc_sli4_process_missed_mbox_completions(phba)) |
6774 | return; | 6768 | return; |
6775 | 6769 | ||
6770 | if (pmbox != NULL) | ||
6771 | mb = &pmbox->u.mb; | ||
6776 | /* Check the pmbox pointer first. There is a race condition | 6772 | /* Check the pmbox pointer first. There is a race condition |
6777 | * between the mbox timeout handler getting executed in the | 6773 | * between the mbox timeout handler getting executed in the |
6778 | * worklist and the mailbox actually completing. When this | 6774 | * worklist and the mailbox actually completing. When this |
@@ -8121,7 +8117,6 @@ lpfc_sli4_scmd_to_wqidx_distr(struct lpfc_hba *phba) | |||
8121 | cpup += cpu; | 8117 | cpup += cpu; |
8122 | return cpup->channel_id; | 8118 | return cpup->channel_id; |
8123 | } | 8119 | } |
8124 | chann = cpu; | ||
8125 | } | 8120 | } |
8126 | chann = atomic_add_return(1, &phba->fcp_qidx); | 8121 | chann = atomic_add_return(1, &phba->fcp_qidx); |
8127 | chann = (chann % phba->cfg_fcp_io_channel); | 8122 | chann = (chann % phba->cfg_fcp_io_channel); |
@@ -12604,6 +12599,9 @@ lpfc_sli4_hba_intr_handler(int irq, void *dev_id) | |||
12604 | * Process all the event on FCP fast-path EQ | 12599 | * Process all the event on FCP fast-path EQ |
12605 | */ | 12600 | */ |
12606 | while ((eqe = lpfc_sli4_eq_get(fpeq))) { | 12601 | while ((eqe = lpfc_sli4_eq_get(fpeq))) { |
12602 | if (eqe == NULL) | ||
12603 | break; | ||
12604 | |||
12607 | lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx); | 12605 | lpfc_sli4_hba_handle_eqe(phba, eqe, fcp_eqidx); |
12608 | if (!(++ecount % fpeq->entry_repost)) | 12606 | if (!(++ecount % fpeq->entry_repost)) |
12609 | lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM); | 12607 | lpfc_sli4_eq_release(fpeq, LPFC_QUEUE_NOARM); |
@@ -14244,7 +14242,6 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba, | |||
14244 | "2511 POST_SGL mailbox failed with " | 14242 | "2511 POST_SGL mailbox failed with " |
14245 | "status x%x add_status x%x, mbx status x%x\n", | 14243 | "status x%x add_status x%x, mbx status x%x\n", |
14246 | shdr_status, shdr_add_status, rc); | 14244 | shdr_status, shdr_add_status, rc); |
14247 | rc = -ENXIO; | ||
14248 | } | 14245 | } |
14249 | return 0; | 14246 | return 0; |
14250 | } | 14247 | } |