Commit 81710ced authored by YiFei Zhu's avatar YiFei Zhu Committed by Greg Kroah-Hartman

x86/earlyprintk/efi: Fix infinite loop on some screen widths

[ Upstream commit 79c2206d369b87b19ac29cb47601059b6bf5c291 ]

An affected screen resolution is 1366 x 768, which width is not
divisible by 8, the default font width. On such screens, when longer
lines are earlyprintk'ed, overflow-to-next-line can never trigger,
due to the left-most x-coordinate of the next character always less
than the screen width. Earlyprintk will infinite loop in trying to
print the rest of the string but unable to, due to the line being

This patch makes the trigger consider the right-most x-coordinate,
instead of left-most, as the value to compare against the screen
width threshold.
Signed-off-by: default avatarYiFei Zhu <>
Signed-off-by: default avatarArd Biesheuvel <>
Cc: Andy Lutomirski <>
Cc: Arend van Spriel <>
Cc: Bhupesh Sharma <>
Cc: Borislav Petkov <>
Cc: Dave Hansen <>
Cc: Eric Snowberg <>
Cc: Hans de Goede <>
Cc: Joe Perches <>
Cc: Jon Hunter <>
Cc: Julien Thierry <>
Cc: Linus Torvalds <>
Cc: Marc Zyngier <>
Cc: Matt Fleming <>
Cc: Nathan Chancellor <>
Cc: Peter Zijlstra <>
Cc: Sai Praneeth Prakhya <>
Cc: Sedat Dilek <>
Cc: Thomas Gleixner <>
Link: default avatarIngo Molnar <>
Signed-off-by: default avatarSasha Levin <>
parent 3a2c2aae
......@@ -179,7 +179,7 @@ early_efi_write(struct console *con, const char *str, unsigned int num)
if (efi_x >= si->lfb_width) {
if (efi_x + font->width > si->lfb_width) {
efi_x = 0;
efi_y += font->height;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment