Skip to content

Commit d823685

Browse files
harperchenhdeller
authored andcommitted
fbdev: intelfb: Fix potential divide by zero
Variable var->pixclock is controlled by user and can be assigned to zero. Without proper check, divide by zero would occur in intelfbhw_validate_mode and intelfbhw_mode_to_hw. Error out if var->pixclock is zero. Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 92e2a00 commit d823685

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/video/fbdev/intelfb/intelfbdrv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
12221222

12231223
dinfo = GET_DINFO(info);
12241224

1225+
if (!var->pixclock)
1226+
return -EINVAL;
1227+
12251228
/* update the pitch */
12261229
if (intelfbhw_validate_mode(dinfo, var) != 0)
12271230
return -EINVAL;

0 commit comments

Comments
 (0)