Skip to content

Commit

Permalink
fbdev: au1200fb: Fix potential divide by zero
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Chen authored and Helge Deller committed Mar 16, 2023
1 parent 61ac4b8 commit 44a3b36
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/video/fbdev/au1200fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 44a3b36

Please sign in to comment.