diff options
author | James Smart <james.smart@emulex.com> | 2014-09-03 12:57:55 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-09-16 12:10:12 -0400 |
commit | a2fc4aefa06d8b57b6728c1787c84fb3d3c86354 (patch) | |
tree | c7833b3e44299747314298646b5d8fa0e8bf5eb6 /drivers/scsi/lpfc/lpfc_init.c | |
parent | 7ba36effb666831ac3803ca5b8aed371e7d17c4e (diff) |
lpfc: fix high priority issues from fortify source code scan
Fixed High 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_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 33a24fc0afec..0d9230486d6e 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -306,10 +306,10 @@ lpfc_dump_wakeup_param_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) | |||
306 | dist = dist_char[prg->dist]; | 306 | dist = dist_char[prg->dist]; |
307 | 307 | ||
308 | if ((prg->dist == 3) && (prg->num == 0)) | 308 | if ((prg->dist == 3) && (prg->num == 0)) |
309 | sprintf(phba->OptionROMVersion, "%d.%d%d", | 309 | snprintf(phba->OptionROMVersion, 32, "%d.%d%d", |
310 | prg->ver, prg->rev, prg->lev); | 310 | prg->ver, prg->rev, prg->lev); |
311 | else | 311 | else |
312 | sprintf(phba->OptionROMVersion, "%d.%d%d%c%d", | 312 | snprintf(phba->OptionROMVersion, 32, "%d.%d%d%c%d", |
313 | prg->ver, prg->rev, prg->lev, | 313 | prg->ver, prg->rev, prg->lev, |
314 | dist, prg->num); | 314 | dist, prg->num); |
315 | mempool_free(pmboxq, phba->mbox_mem_pool); | 315 | mempool_free(pmboxq, phba->mbox_mem_pool); |
@@ -3177,9 +3177,11 @@ lpfc_sli4_xri_sgl_update(struct lpfc_hba *phba) | |||
3177 | for (i = 0; i < scsi_xri_cnt; i++) { | 3177 | for (i = 0; i < scsi_xri_cnt; i++) { |
3178 | list_remove_head(&scsi_sgl_list, psb, | 3178 | list_remove_head(&scsi_sgl_list, psb, |
3179 | struct lpfc_scsi_buf, list); | 3179 | struct lpfc_scsi_buf, list); |
3180 | pci_pool_free(phba->lpfc_scsi_dma_buf_pool, psb->data, | 3180 | if (psb) { |
3181 | psb->dma_handle); | 3181 | pci_pool_free(phba->lpfc_scsi_dma_buf_pool, |
3182 | kfree(psb); | 3182 | psb->data, psb->dma_handle); |
3183 | kfree(psb); | ||
3184 | } | ||
3183 | } | 3185 | } |
3184 | spin_lock_irq(&phba->scsi_buf_list_get_lock); | 3186 | spin_lock_irq(&phba->scsi_buf_list_get_lock); |
3185 | phba->sli4_hba.scsi_xri_cnt -= scsi_xri_cnt; | 3187 | phba->sli4_hba.scsi_xri_cnt -= scsi_xri_cnt; |
@@ -7424,7 +7426,8 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7424 | if (rc) { | 7426 | if (rc) { |
7425 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7427 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7426 | "0523 Failed setup of fast-path EQ " | 7428 | "0523 Failed setup of fast-path EQ " |
7427 | "(%d), rc = 0x%x\n", fcp_eqidx, rc); | 7429 | "(%d), rc = 0x%x\n", fcp_eqidx, |
7430 | (uint32_t)rc); | ||
7428 | goto out_destroy_hba_eq; | 7431 | goto out_destroy_hba_eq; |
7429 | } | 7432 | } |
7430 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 7433 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
@@ -7455,7 +7458,8 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7455 | if (rc) { | 7458 | if (rc) { |
7456 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7459 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7457 | "0527 Failed setup of fast-path FCP " | 7460 | "0527 Failed setup of fast-path FCP " |
7458 | "CQ (%d), rc = 0x%x\n", fcp_cqidx, rc); | 7461 | "CQ (%d), rc = 0x%x\n", fcp_cqidx, |
7462 | (uint32_t)rc); | ||
7459 | goto out_destroy_fcp_cq; | 7463 | goto out_destroy_fcp_cq; |
7460 | } | 7464 | } |
7461 | 7465 | ||
@@ -7495,7 +7499,8 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7495 | if (rc) { | 7499 | if (rc) { |
7496 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7500 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7497 | "0535 Failed setup of fast-path FCP " | 7501 | "0535 Failed setup of fast-path FCP " |
7498 | "WQ (%d), rc = 0x%x\n", fcp_wqidx, rc); | 7502 | "WQ (%d), rc = 0x%x\n", fcp_wqidx, |
7503 | (uint32_t)rc); | ||
7499 | goto out_destroy_fcp_wq; | 7504 | goto out_destroy_fcp_wq; |
7500 | } | 7505 | } |
7501 | 7506 | ||
@@ -7528,7 +7533,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7528 | if (rc) { | 7533 | if (rc) { |
7529 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7534 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7530 | "0529 Failed setup of slow-path mailbox CQ: " | 7535 | "0529 Failed setup of slow-path mailbox CQ: " |
7531 | "rc = 0x%x\n", rc); | 7536 | "rc = 0x%x\n", (uint32_t)rc); |
7532 | goto out_destroy_fcp_wq; | 7537 | goto out_destroy_fcp_wq; |
7533 | } | 7538 | } |
7534 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 7539 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
@@ -7548,7 +7553,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7548 | if (rc) { | 7553 | if (rc) { |
7549 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7554 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7550 | "0531 Failed setup of slow-path ELS CQ: " | 7555 | "0531 Failed setup of slow-path ELS CQ: " |
7551 | "rc = 0x%x\n", rc); | 7556 | "rc = 0x%x\n", (uint32_t)rc); |
7552 | goto out_destroy_mbx_cq; | 7557 | goto out_destroy_mbx_cq; |
7553 | } | 7558 | } |
7554 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 7559 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
@@ -7592,7 +7597,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7592 | if (rc) { | 7597 | if (rc) { |
7593 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7598 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7594 | "0537 Failed setup of slow-path ELS WQ: " | 7599 | "0537 Failed setup of slow-path ELS WQ: " |
7595 | "rc = 0x%x\n", rc); | 7600 | "rc = 0x%x\n", (uint32_t)rc); |
7596 | goto out_destroy_mbx_wq; | 7601 | goto out_destroy_mbx_wq; |
7597 | } | 7602 | } |
7598 | 7603 | ||
@@ -7624,7 +7629,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
7624 | if (rc) { | 7629 | if (rc) { |
7625 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 7630 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
7626 | "0541 Failed setup of Receive Queue: " | 7631 | "0541 Failed setup of Receive Queue: " |
7627 | "rc = 0x%x\n", rc); | 7632 | "rc = 0x%x\n", (uint32_t)rc); |
7628 | goto out_destroy_fcp_wq; | 7633 | goto out_destroy_fcp_wq; |
7629 | } | 7634 | } |
7630 | 7635 | ||
@@ -8815,7 +8820,8 @@ lpfc_sli4_enable_msix(struct lpfc_hba *phba) | |||
8815 | /* Assign MSI-X vectors to interrupt handlers */ | 8820 | /* Assign MSI-X vectors to interrupt handlers */ |
8816 | for (index = 0; index < vectors; index++) { | 8821 | for (index = 0; index < vectors; index++) { |
8817 | memset(&phba->sli4_hba.handler_name[index], 0, 16); | 8822 | memset(&phba->sli4_hba.handler_name[index], 0, 16); |
8818 | sprintf((char *)&phba->sli4_hba.handler_name[index], | 8823 | snprintf((char *)&phba->sli4_hba.handler_name[index], |
8824 | LPFC_SLI4_HANDLER_NAME_SZ, | ||
8819 | LPFC_DRIVER_HANDLER_NAME"%d", index); | 8825 | LPFC_DRIVER_HANDLER_NAME"%d", index); |
8820 | 8826 | ||
8821 | phba->sli4_hba.fcp_eq_hdl[index].idx = index; | 8827 | phba->sli4_hba.fcp_eq_hdl[index].idx = index; |