linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] video: mb862xxfb: prevent divide by zero bug
@ 2012-08-18 15:55 Dan Carpenter
       [not found] ` <20120818155541.GB22424-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  2012-08-23 20:30 ` Florian Tobias Schandinat
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-08-18 15:55 UTC (permalink / raw)
  To: Florian Tobias Schandinat
  Cc: linux-fbdev-u79uwXL29TY76Z2rM5mHXA, H Hartley Sweeten,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Paul Gortmaker, Laurent Pinchart, David Brown

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-23 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18 15:55 [patch] video: mb862xxfb: prevent divide by zero bug Dan Carpenter
     [not found] ` <20120818155541.GB22424-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2012-08-18 18:35   ` Anatolij Gustschin
2012-08-23 20:30 ` Florian Tobias Schandinat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).