diff mbox series

scsi: lpfc: Fix error code if kcalloc() fails

Message ID 20190211184300.GA22106@kadam (mailing list archive)
State Mainlined
Commit fad28e3d9aa14522e33694b63ccccdf28e64a8e0
Headers show
Series scsi: lpfc: Fix error code if kcalloc() fails | expand

Commit Message

Dan Carpenter Feb. 11, 2019, 6:43 p.m. UTC
This should return -ENOMEM if kcalloc() fails, but it accidentally
returns success instead.

Fixes: 6a828b0f6192 ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/lpfc/lpfc_init.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Ewan Milne Feb. 11, 2019, 8:19 p.m. UTC | #1
On Mon, 2019-02-11 at 21:43 +0300, Dan Carpenter wrote:
> This should return -ENOMEM if kcalloc() fails, but it accidentally
> returns success instead.
> 
> Fixes: 6a828b0f6192 ("scsi: lpfc: Support non-uniform allocation of MSIX vectors to hardware queues")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/scsi/lpfc/lpfc_init.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
> index 900edae7ccc4..aa801d2f36e5 100644
> --- a/drivers/scsi/lpfc/lpfc_init.c
> +++ b/drivers/scsi/lpfc/lpfc_init.c
> @@ -9638,6 +9638,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba)
>  			lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
>  					"0549 Failed setup of CQ Lookup table: "
>  					"size 0x%x\n", phba->sli4_hba.cq_max);
> +			rc = -ENOMEM;
>  			goto out_destroy;
>  		}
>  		lpfc_setup_cq_lookup(phba);

Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Martin K. Petersen Feb. 13, 2019, 3:16 a.m. UTC | #2
Dan,

> This should return -ENOMEM if kcalloc() fails, but it accidentally
> returns success instead.

Applied to 5.1/scsi-queue, thanks!
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 900edae7ccc4..aa801d2f36e5 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -9638,6 +9638,7 @@  lpfc_sli4_queue_setup(struct lpfc_hba *phba)
 			lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
 					"0549 Failed setup of CQ Lookup table: "
 					"size 0x%x\n", phba->sli4_hba.cq_max);
+			rc = -ENOMEM;
 			goto out_destroy;
 		}
 		lpfc_setup_cq_lookup(phba);