PIXEL_BIT_MASK formats can have either less or more than four bytes per pixel so lets fix the lfb_linelenght calculation when applying the swapped width and height quirks.
Signed-off-by: Tvrtko Ursulin <[email protected]> Suggested-by: Thomas Zimmermann <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Melissa Wen <[email protected]> Cc: [email protected] --- drivers/firmware/efi/sysfb_efi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c index 1d8b6966731c..14b61414c33a 100644 --- a/drivers/firmware/efi/sysfb_efi.c +++ b/drivers/firmware/efi/sysfb_efi.c @@ -358,7 +358,9 @@ __init void sysfb_apply_efi_quirks(void) if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI && dmi_check_system(efifb_dmi_swap_width_height)) { swap(screen_info.lfb_width, screen_info.lfb_height); - screen_info.lfb_linelength = 4 * screen_info.lfb_width; + screen_info.lfb_linelength = (unsigned int)screen_info.lfb_depth * + screen_info.lfb_width / + BITS_PER_BYTE; } } -- 2.51.1
