forked from luck/tmp_suning_uos_patched
drm/nouveau/bios: fix a potential NULL deref in the PROM shadowing function
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martin Peres <martin.peres@free.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
9044fa60fd
commit
29ba8c8abf
@ -183,10 +183,11 @@ nouveau_bios_shadow_prom(struct nouveau_bios *bios)
|
||||
goto out;
|
||||
|
||||
bios->data = kmalloc(bios->size, GFP_KERNEL);
|
||||
if (bios->data) {
|
||||
for (i = 0; i < bios->size; i += 4)
|
||||
((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
|
||||
}
|
||||
if (!bios->data)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < bios->size; i += 4)
|
||||
((u32 *)bios->data)[i/4] = nv_rd32(bios, 0x300000 + i);
|
||||
|
||||
/* check the PCI record header */
|
||||
pcir = nv_ro16(bios, 0x0018);
|
||||
|
Loading…
Reference in New Issue
Block a user