From: Roel Kluin <roel.kluin@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] zfcp: Test kmalloc failure in scsi_get_vpd_page()
Date: Mon, 24 Aug 2009 18:21:44 +0200 [thread overview]
Message-ID: <4A92BE18.50208@gmail.com> (raw)
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;
next reply other threads:[~2009-08-24 16:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-24 16:21 Roel Kluin [this message]
2009-08-27 23:45 ` [PATCH] zfcp: Test kmalloc failure in scsi_get_vpd_page() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A92BE18.50208@gmail.com \
--to=roel.kluin@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox