summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-10-22 10:08:19 +1000
committerBen Skeggs <bskeggs@redhat.com>2012-10-22 13:39:38 +1000
commitd1626a965141b1e600efad29947b6c36dab183c3 (patch)
treeca7fb5ae9b716f6d87af3a8890d9de47b338d006 /drivers
parent00e4845bad84689fbaacc86bc54a0b99d5d3c1fc (diff)
drm/nouveau/bios: fetch full 4KiB block to determine ACPI ROM image size
Buggy firmware leads to bad things happening otherwise.. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index 3a84ad4f171a..70ca7d5a1aa1 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -192,7 +192,6 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
{
struct pci_dev *pdev = nv_device(bios)->pdev;
int ret, cnt, i;
- u8 data[3];
if (!nouveau_acpi_rom_supported(pdev)) {
bios->data = NULL;
@@ -200,8 +199,13 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
}
bios->size = 0;
- if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
- bios->size = data[2] * 512;
+ bios->data = kmalloc(4096, GFP_KERNEL);
+ if (bios->data) {
+ if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096)
+ bios->size = bios->data[2] * 512;
+ kfree(bios->data);
+ }
+
if (!bios->size)
return;