summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWei Chen <harperchen1110@gmail.com>2023-03-15 09:22:54 +0000
committerHelge Deller <deller@gmx.de>2023-03-16 16:18:17 +0100
commit44a3b36b42acfc433aaaf526191dd12fbb919fdb (patch)
tree2974779ca39bfe92e85466b5c5ac63cf5b3402ef /drivers
parent61ac4b86a4c047c20d5cb423ddd87496f14d9868 (diff)
fbdev: au1200fb: Fix potential divide by zero
var->pixclock can be assigned to zero by user. Without proper check, divide by zero would occur when invoking macro PICOS2KHZ in au1200fb_fb_check_var. Error out if var->pixclock is zero. Signed-off-by: Wei Chen <harperchen1110@gmail.com> Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fbdev/au1200fb.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c
index 81c315454428..b6b22fa4a8a0 100644
--- a/drivers/video/fbdev/au1200fb.c
+++ b/drivers/video/fbdev/au1200fb.c
@@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
u32 pixclock;
int screen_size, plane;
+ if (!var->pixclock)
+ return -EINVAL;
+
plane = fbdev->plane;
/* Make sure that the mode respect all LCD controller and