linux-stable/drivers/video
Saeed Mirzamohammadi cc07057c7c video: fbdev: fix divide error in fbcon_switch
This patch fixes the issue due to:

[   89.572883] divide_error: 0000 [#1] SMP KASAN PTI
[   89.572897] CPU: 3 PID: 16083 Comm: repro Not tainted 5.9.0-rc7.20200930.rc1.allarch-19-g3e32d0d.syzk #5
[   89.572902] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011
[   89.572934] RIP: 0010:cirrusfb_check_var+0x84/0x1260

The error happens when the pixels value is calculated before performing the sanity checks on bits_per_pixel.
A bits_per_pixel set to zero causes divide by zero error.

This patch moves the calculation after the sanity check.

Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Tested-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Reviewed-by: Thomas Zimemrmann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20201021235758.59993-1-saeed.mirzamohammadi@oracle.com
2020-10-23 08:47:30 +02:00
..
backlight treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
console TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
fbdev video: fbdev: fix divide error in fbcon_switch 2020-10-23 08:47:30 +02:00
logo
display_timing.c
hdmi.c drm-misc-next for v5.9: 2020-06-24 15:45:51 +10:00
Kconfig
Makefile
of_display_timing.c
of_videomode.c
vgastate.c
videomode.c