3.6-stable review patch. If anyone has any objections, please let me know.
------------------ From: Ben Skeggs <bske...@redhat.com> commit 9a334cd0de2f43b29c192548000692bad52edfc6 upstream. Signed-off-by: Ben Skeggs <bske...@redhat.com> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- drivers/gpu/drm/nouveau/nouveau_bios.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c @@ -196,24 +196,22 @@ static void bios_shadow_acpi(struct nvbios *bios) { struct pci_dev *pdev = bios->dev->pdev; - int cnt = 65536 / ROM_BIOS_PAGE; - int ret; + int ret, cnt, i; + u8 data[3]; if (!nouveau_acpi_rom_supported(pdev)) return; - bios->data = kmalloc(cnt * ROM_BIOS_PAGE, GFP_KERNEL); - if (!bios->data) - return; - bios->length = 0; - while (cnt--) { - ret = nouveau_acpi_get_bios_chunk(bios->data, bios->length, - ROM_BIOS_PAGE); - if (ret != ROM_BIOS_PAGE) - return; + if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) + bios->length = data[2] * 512; - bios->length += ROM_BIOS_PAGE; + bios->data = kmalloc(bios->length, GFP_KERNEL); + for (i = 0; bios->data && i < bios->length; i += cnt) { + cnt = min((bios->length - i), (u32)4096); + ret = nouveau_acpi_get_bios_chunk(bios->data, i, cnt); + if (ret != cnt) + break; } } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/