Commit a2cf8a63 authored by Davidlohr Bueso A's avatar Davidlohr Bueso A Committed by James Bottomley

[SCSI] ch: Check NULL for kmalloc() return

Verify that ch->dt is not NULL before using it.
Signed-off-by: default avatarDavidlohr Bueso <dave@gnu.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent d6886692
...@@ -353,6 +353,12 @@ ch_readconfig(scsi_changer *ch) ...@@ -353,6 +353,12 @@ ch_readconfig(scsi_changer *ch)
/* look up the devices of the data transfer elements */ /* look up the devices of the data transfer elements */
ch->dt = kmalloc(ch->counts[CHET_DT]*sizeof(struct scsi_device), ch->dt = kmalloc(ch->counts[CHET_DT]*sizeof(struct scsi_device),
GFP_KERNEL); GFP_KERNEL);
if (!ch->dt) {
kfree(buffer);
return -ENOMEM;
}
for (elem = 0; elem < ch->counts[CHET_DT]; elem++) { for (elem = 0; elem < ch->counts[CHET_DT]; elem++) {
id = -1; id = -1;
lun = 0; lun = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment