summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorDavidlohr Bueso A <dave@gnu.org>2009-08-07 16:42:21 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 17:52:22 -0500
commita2cf8a6306c89223d0ed35a7e9d40da99902e32a (patch)
treebac3fabe15b299cd7d056f6bd501229d663c70b2 /drivers/scsi
parentd68866927ddd0ed3145cb3fba4a1c07ca5e4709d (diff)
downloadlinux-stable-a2cf8a6306c89223d0ed35a7e9d40da99902e32a.tar.gz
linux-stable-a2cf8a6306c89223d0ed35a7e9d40da99902e32a.tar.bz2
linux-stable-a2cf8a6306c89223d0ed35a7e9d40da99902e32a.zip
[SCSI] ch: Check NULL for kmalloc() return
Verify that ch->dt is not NULL before using it. Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 7b1633a8c15a..fe11c1d4b31d 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -353,6 +353,12 @@ ch_readconfig(scsi_changer *ch)
/* look up the devices of the data transfer elements */
ch->dt = kmalloc(ch->counts[CHET_DT]*sizeof(struct scsi_device),
GFP_KERNEL);
+
+ if (!ch->dt) {
+ kfree(buffer);
+ return -ENOMEM;
+ }
+
for (elem = 0; elem < ch->counts[CHET_DT]; elem++) {
id = -1;
lun = 0;