public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zfcp: Test kmalloc failure in scsi_get_vpd_page()
@ 2009-08-24 16:21 Roel Kluin
  2009-08-27 23:45 ` James Bottomley
  0 siblings, 1 reply; 12+ messages in thread
From: Roel Kluin @ 2009-08-24 16:21 UTC (permalink / raw)
  To: James E.J. Bottomley, linux-scsi, Andrew Morton

kmalloc() may fail, so test whether it succeeded.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 2de5f3a..34fdde0 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1056,6 +1056,9 @@ unsigned char *scsi_get_vpd_page(struct scsi_device *sdev, u8 page)
 
 	kfree(buf);
 	buf = kmalloc(len + 4, GFP_KERNEL);
+	if (!buf)
+		return NULL;
+
 	result = scsi_vpd_inquiry(sdev, buf, page, len);
 	if (result)
 		goto fail;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-08  9:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-24 16:21 [PATCH] zfcp: Test kmalloc failure in scsi_get_vpd_page() Roel Kluin
2009-08-27 23:45 ` James Bottomley
2009-08-30 11:45   ` Boaz Harrosh
2009-08-30 14:35     ` James Bottomley
2009-11-03 18:33       ` James Bottomley
2009-11-04  8:54         ` Boaz Harrosh
2009-11-04 15:09           ` James Bottomley
2009-11-04 16:18             ` Boaz Harrosh
2009-11-04 17:50               ` James Bottomley
2009-11-05  8:29                 ` Boaz Harrosh
2009-11-05 19:41                   ` James Bottomley
2009-11-08  9:19                     ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox