Skip to contentSkip to conversation

hpsa: Checking for a NULL return from a kzalloc call

PATCH New Joe Handzik 1 participant 1 message Mar 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpsa: Checking for a NULL return from a kzalloc call

From: Joe Handzik <[email protected]>

Checking for a NULL return from a kzalloc call in hpsa_get_pdisk_of_ioaccel2.

---
 drivers/scsi/hpsa.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +2 -0
index 8cf4a0c..2d37257 100644
@@ -2836,6 +2836,8 @@ static int hpsa_get_pdisk_of_ioaccel2(struct ctlr_info *h,
 
 	/* Get the list of physical devices */
 	physicals = kzalloc(reportsize, GFP_KERNEL);
+	if (physicals == NULL)
+		return 0;
 	if (hpsa_scsi_do_report_phys_luns(h, (struct ReportLUNdata *) physicals,
 		reportsize, extended)) {
 		dev_err(&h->pdev->dev,