]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/nouveau/bios: return actual size of the buffer retrieved via _ROM
authorBen Skeggs <bskeggs@redhat.com>
Thu, 19 Nov 2015 03:18:34 +0000 (13:18 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 25 Nov 2015 05:31:21 +0000 (15:31 +1000)
Fixes detection of a failed attempt at fetching the entire ROM image
in one-shot (a violation of the spec, that works a lot of the time).

Tested on a HP Zbook 15 G2.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_acpi.c

index 8b8332e46f24059f561ca5b1f814ed849d51aa7b..d5e6938cc6bc06e9e2903a81da002289ae9e5688 100644 (file)
@@ -367,6 +367,7 @@ static int nouveau_rom_call(acpi_handle rom_handle, uint8_t *bios,
                return -ENODEV;
        }
        obj = (union acpi_object *)buffer.pointer;
+       len = min(len, (int)obj->buffer.length);
        memcpy(bios+offset, obj->buffer.pointer, len);
        kfree(buffer.pointer);
        return len;