Skip to content

Commit 1b777d4

Browse files
crackmonkeykarolherbst
authored andcommitted
drm/nouveau: fix off by one in BIOS boundary checking
Bounds checking when parsing init scripts embedded in the BIOS reject access to the last byte. This causes driver initialization to fail on Apple eMac's with GeForce 2 MX GPUs, leaving the system with no working console. This is probably only seen on OpenFirmware machines like PowerPC Macs because the BIOS image provided by OF is only the used parts of the ROM, not a power-of-two blocks read from PCI directly so PCs always have empty bytes at the end that are never accessed. Signed-off-by: Nick Lopez <[email protected]> Fixes: 4d4e990 ("drm/nouveau/bios: guard against out-of-bounds accesses to image") Cc: <[email protected]> # v4.10+ Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Signed-off-by: Karol Herbst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 43f2517 commit 1b777d4

File tree

1 file changed

+1
-1
lines changed
  • drivers/gpu/drm/nouveau/nvkm/subdev/bios

1 file changed

+1
-1
lines changed

drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 *addr, u8 size)
3838
*addr += bios->imaged_addr;
3939
}
4040

41-
if (unlikely(*addr + size >= bios->size)) {
41+
if (unlikely(*addr + size > bios->size)) {
4242
nvkm_error(&bios->subdev, "OOB %d %08x %08x\n", size, p, *addr);
4343
return false;
4444
}

0 commit comments

Comments
 (0)