Skip to content

Commit

Permalink
video: mb862xxfb: prevent divide by zero bug
Browse files Browse the repository at this point in the history
Do a sanity check on these before using them as divisors.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
  • Loading branch information
Dan Carpenter authored and Florian Tobias Schandinat committed Aug 23, 2012
1 parent 01817d1 commit 2568236
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/video/mb862xx/mb862xxfbdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ static int mb862xxfb_ioctl(struct fb_info *fbi, unsigned int cmd,
case MB862XX_L1_SET_CFG:
if (copy_from_user(l1_cfg, argp, sizeof(*l1_cfg)))
return -EFAULT;
if (l1_cfg->dh == 0 || l1_cfg->dw == 0)
return -EINVAL;
if ((l1_cfg->sw >= l1_cfg->dw) && (l1_cfg->sh >= l1_cfg->dh)) {
/* downscaling */
outreg(cap, GC_CAP_CSC,
Expand Down

0 comments on commit 2568236

Please sign in to comment.