mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
[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>
This commit is contained in:
parent
d68866927d
commit
a2cf8a6306
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue