linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch v2] [media] rc-core: prevent divide by zero bug in s_tx_carrier()
@ 2012-09-09 20:31 Dan Carpenter
  2012-09-09 21:01 ` walter harms
  2012-09-09 22:26 ` Sean Young
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-09-09 20:31 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Paul Gortmaker, Sean Young, David Härdeman, Ben Hutchings,
	linux-media, kernel-janitors

Several of the drivers use carrier as a divisor in their s_tx_carrier()
functions.  We should do a sanity check here like we do for
LIRC_SET_REC_CARRIER.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Ben Hutchings pointed out that my first patch was not a complete
    fix.

diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 6ad4a07..28dc0f0 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -211,6 +211,9 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
 		if (!dev->s_tx_carrier)
 			return -EINVAL;
 
+		if (val <= 0)
+			return -EINVAL;
+
 		return dev->s_tx_carrier(dev, val);
 
 	case LIRC_SET_SEND_DUTY_CYCLE:

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

end of thread, other threads:[~2012-09-11 11:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-09 20:31 [patch v2] [media] rc-core: prevent divide by zero bug in s_tx_carrier() Dan Carpenter
2012-09-09 21:01 ` walter harms
2012-09-09 22:00   ` Ben Hutchings
2012-09-09 22:26 ` Sean Young
2012-09-09 22:38   ` Ben Hutchings
2012-09-11 11:11   ` [patch v3] [media] rc: divide by zero bugs " Dan Carpenter

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).