From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: "Paul Gortmaker" <paul.gortmaker@windriver.com>,
"Sean Young" <sean@mess.org>,
"David Härdeman" <david@hardeman.nu>,
"Ben Hutchings" <ben@decadent.org.uk>,
linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch v2] [media] rc-core: prevent divide by zero bug in s_tx_carrier()
Date: Sun, 9 Sep 2012 23:31:42 +0300 [thread overview]
Message-ID: <20120909203142.GA12296@elgon.mountain> (raw)
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:
next reply other threads:[~2012-09-09 20:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-09 20:31 Dan Carpenter [this message]
2012-09-09 21:01 ` [patch v2] [media] rc-core: prevent divide by zero bug in s_tx_carrier() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120909203142.GA12296@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=ben@decadent.org.uk \
--cc=david@hardeman.nu \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=paul.gortmaker@windriver.com \
--cc=sean@mess.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).