Skip to contentSkip to conversation

video: mb862xxfb: prevent divide by zero bug

PATCH Applied Dan Carpenter 3 participants 3 messages Aug 18, 2012 – Aug 23, 2012 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: mb862xxfb: prevent divide by zero bug

Do a sanity check on these before using them as divisors.

drivers/video/mb862xx/mb862xxfbdrv.c +2 -0
index 00ce1f3..57d940b 100644
@@ -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,

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · On Sat, 18 Aug 2012 18:55:41 +0300 Dan Carpenter <[email protected]>…

Do a sanity check on these before using them as divisors.

drivers/video/mb862xx/mb862xxfbdrv.c static int mb862xxfb_ioctl(struct fb_info *fbi, unsigned int cmd, · line 335

Quoted 13 lines
drivers/video/mb862xx/mb862xxfbdrv.c +2 -0
index 00ce1f3..57d940b 100644
@@ -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,

Thanks,

Anatolij

#3 lore raw
In reply to Dan Carpenter
Quoted 3 lines · Dan Carpenter

Do a sanity check on these before using them as divisors.

Applied.

Thanks,

Florian Tobias Schandinat

Quoted 15 lines
drivers/video/mb862xx/mb862xxfbdrv.c +2 -0
index 00ce1f3..57d940b 100644
@@ -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,