Skip to content

Commit 2e337dd

Browse files
author
Jocelyn Falempe
committed
drm/panic: Fix divide by 0 if the screen width < font width
In the unlikely case that the screen is tiny, and smaller than the font width, it leads to a divide by 0: draw_line_with_wrap() chars_per_row = sb->width / font->width = 0 line_wrap.len = line->len % chars_per_row; This will trigger a divide by 0 Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jocelyn Falempe <[email protected]>
1 parent e9b36fe commit 2e337dd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/drm_panic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static void draw_panic_static_kmsg(struct drm_scanout_buffer *sb)
523523
struct drm_panic_line line;
524524
int yoffset;
525525

526-
if (!font)
526+
if (!font || font->width > sb->width)
527527
return;
528528

529529
yoffset = sb->height - font->height - (sb->height % font->height) / 2;

0 commit comments

Comments
 (0)