Skip to content

Commit 44a3b36

Browse files
harperchenhdeller
authored andcommitted
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 <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 61ac4b8 commit 44a3b36

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/video/fbdev/au1200fb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,
10401040
u32 pixclock;
10411041
int screen_size, plane;
10421042

1043+
if (!var->pixclock)
1044+
return -EINVAL;
1045+
10431046
plane = fbdev->plane;
10441047

10451048
/* Make sure that the mode respect all LCD controller and

0 commit comments

Comments
 (0)