Skip to content

Commit 75a1621

Browse files
avasummergregkh
authored andcommitted
staging: sm750fb: fix division by zero in ps_to_hz()
ps_to_hz() is called from hw_sm750_crtc_set_mode() without validating that pixclock is non-zero. A zero pixclock passed via FBIOPUT_VSCREENINFO causes a division by zero. Fix by rejecting zero pixclock in lynxfb_ops_check_var(), consistent with other framebuffer drivers. Fixes: 81dee67 ("staging: sm750fb: add sm750 to staging") Reported-by: Yuhao Jiang <danisjiang@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Junrui Luo <moonafterrain@outlook.com> Link: https://patch.msgid.link/SYBPR01MB7881AFBFCE28CCF528B35D0CAF4BA@SYBPR01MB7881.ausprd01.prod.outlook.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2541d18 commit 75a1621

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/staging/sm750fb/sm750.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo *var,
481481
struct lynxfb_crtc *crtc;
482482
resource_size_t request;
483483

484+
if (!var->pixclock)
485+
return -EINVAL;
486+
484487
ret = 0;
485488
par = info->par;
486489
crtc = &par->crtc;

0 commit comments

Comments
 (0)