diff mbox series

[2/4] scsi: lpfc: Return directly after a failed kzalloc() in lpfc_sli_read_link_ste()

Message ID cef48477-8331-4d84-a3ee-8e6b2f6e34e8@web.de
State New
Headers show
Series scsi: lpfc: Adjustments for two function implementations | expand

Commit Message

Markus Elfring Dec. 28, 2023, 5:24 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 28 Dec 2023 17:13:50 +0100

The kfree() function was called in one case by
the lpfc_sli_read_link_ste() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus return directly after a call of the function “kzalloc” failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.43.0
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 706985358c6a..93339425ce3c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -20701,7 +20701,7 @@  lpfc_sli_read_link_ste(struct lpfc_hba *phba)
 	/* Get adapter Region 23 data */
 	rgn23_data = kzalloc(DMP_RGN23_SIZE, GFP_KERNEL);
 	if (!rgn23_data)
-		goto out;
+		return;

 	if (phba->sli_rev < LPFC_SLI_REV4)
 		data_size = lpfc_sli_get_config_region23(phba, rgn23_data);