From: Ben Skeggs Date: Thu, 19 Nov 2015 03:18:34 +0000 (+1000) Subject: drm/nouveau/bios: return actual size of the buffer retrieved via _ROM X-Git-Tag: v4.4-rc3~1^2^2~6 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=954329412ea45ad6b509aa26f1441941fd432823;p=uclinux-h8%2Flinux.git drm/nouveau/bios: return actual size of the buffer retrieved via _ROM 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 --- diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 8b8332e46f24..d5e6938cc6bc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -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;