提交 d8236854 编写于 作者: W Wei Chen 提交者: Helge Deller

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: NWei Chen <harperchen1110@gmail.com>
Signed-off-by: NHelge Deller <deller@gmx.de>
上级 92e2a00f
...@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var, ...@@ -1222,6 +1222,9 @@ static int intelfb_check_var(struct fb_var_screeninfo *var,
dinfo = GET_DINFO(info); dinfo = GET_DINFO(info);
if (!var->pixclock)
return -EINVAL;
/* update the pitch */ /* update the pitch */
if (intelfbhw_validate_mode(dinfo, var) != 0) if (intelfbhw_validate_mode(dinfo, var) != 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册