projects
/
platform
/
kernel
/
linux-3.10.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d688669
)
[SCSI] ch: Check NULL for kmalloc() return
author
Davidlohr Bueso A
<dave@gnu.org>
Fri, 7 Aug 2009 20:42:21 +0000
(16:42 -0400)
committer
James Bottomley
<James.Bottomley@suse.de>
Sat, 22 Aug 2009 22:52:22 +0000
(17:52 -0500)
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>
drivers/scsi/ch.c
patch
|
blob
|
history
diff --git
a/drivers/scsi/ch.c
b/drivers/scsi/ch.c
index
7b1633a
..
fe11c1d
100644
(file)
--- 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;