Commit 29ba8c8a authored by Martin Peres's avatar Martin Peres Committed by Ben Skeggs

drm/nouveau/bios: fix a potential NULL deref in the PROM shadowing function

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarMartin Peres <martin.peres@free.fr>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 9044fa60
...@@ -183,10 +183,11 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios) ...@@ -183,10 +183,11 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
goto out; goto out;
bios->data = kmalloc(bios->size, GFP_KERNEL); bios->data = kmalloc(bios->size, GFP_KERNEL);
if (bios->data) { if (!bios->data)
for (i = 0; i < bios->size; i += 4) goto out;
((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
} for (i = 0; i < bios->size; i += 4)
((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
/* check the PCI record header */ /* check the PCI record header */
pcir = nv_ro16(bios, 0x0018); pcir = nv_ro16(bios, 0x0018);
......
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