Message ID | 20200313222258.15659-2-mikel@mikelr.com |
---|---|
State | New |
Headers | show |
Series | Fix loading of platform ROM from 32-bit EFI | expand |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index c42f73fad3e3..c3ae4c92a115 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c @@ -118,11 +118,14 @@ static bool radeon_read_platform_bios(struct radeon_device *rdev) return false; } - if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { + rdev->bios = kzalloc(size, GFP_KERNEL); + if (!rdev->bios) return false; - } - rdev->bios = kmemdup(bios, size, GFP_KERNEL); - if (rdev->bios == NULL) { + + memcpy_fromio(rdev->bios, bios, size); + + if (size == 0 || rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) { + kfree(rdev->bios); return false; }
pci_platform_rom() returns an __iomem pointer which should not be accessed directly. Change radeon_read_platform_bios() to use memcpy_fromio() instead of calling kmemdup() on the __iomem pointer. Signed-off-by: Mikel Rychliski <mikel@mikelr.com> --- drivers/gpu/drm/radeon/radeon_bios.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)