提交 a2cf8a63 编写于 作者: D Davidlohr Bueso A 提交者: James Bottomley

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

Verify that ch->dt is not NULL before using it.
Signed-off-by: NDavidlohr Bueso <dave@gnu.org>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 d6886692
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册