All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <garsilva@embeddedor.com>
Subject: [PATCH 5/8] pci: cx88-input: fix potential integer overflow
Date: Mon, 29 Jan 2018 18:32:21 -0600	[thread overview]
Message-ID: <7958c3115b5727c2272ce9cf7454cea8e6f4cc50.1517268668.git.gustavo@embeddedor.com> (raw)
In-Reply-To: <cover.1517268667.git.gustavo@embeddedor.com>

Cast ir->polling to ktime_t in order to avoid a potential integer
overflow. This variable is being used in a context that expects
an expression of type ktime_t (s64).

Addresses-Coverity-ID: 1392628 ("Unintentional integer overflow")
Addresses-Coverity-ID: 1392630 ("Unintentional integer overflow")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/media/pci/cx88/cx88-input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index 4e9953e..096b350 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -180,7 +180,7 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
 	struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
 
 	cx88_ir_handle_key(ir);
-	missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000);
+	missed = hrtimer_forward_now(&ir->timer, (ktime_t)ir->polling * 1000000);
 	if (missed > 1)
 		ir_dprintk("Missed ticks %ld\n", missed - 1);
 
@@ -200,7 +200,7 @@ static int __cx88_ir_start(void *priv)
 	if (ir->polling) {
 		hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		ir->timer.function = cx88_ir_work;
-		hrtimer_start(&ir->timer, ir->polling * 1000000,
+		hrtimer_start(&ir->timer, (ktime_t)ir->polling * 1000000,
 			      HRTIMER_MODE_REL);
 	}
 	if (ir->sampling) {
-- 
2.7.4

  parent reply	other threads:[~2018-01-30  0:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  0:30 [PATCH 0/8] fix potential integer overflows Gustavo A. R. Silva
2018-01-30  1:07 ` [PATCH resend " Gustavo A. R. Silva
2018-01-30  1:07 ` Gustavo A. R. Silva
2018-01-30  0:30 ` [PATCH " Gustavo A. R. Silva
2018-01-30  0:30 ` [PATCH 1/8] rtl2832: fix potential integer overflow in rtl2832_set_frontend Gustavo A. R. Silva
2018-01-30  0:31 ` [PATCH 2/8] dvb-frontends: ves1820: fix potential integer overflow Gustavo A. R. Silva
2018-01-30  0:31 ` [PATCH 3/8] i2c: max2175: fix potential integer overflow in max2175_set_nco_freq Gustavo A. R. Silva
2018-01-30  0:32 ` [PATCH 4/8] i2c: ov9650: fix potential integer overflow in __ov965x_set_frame_interval Gustavo A. R. Silva
2018-02-02  9:22   ` Sakari Ailus
2018-01-30  0:32 ` Gustavo A. R. Silva [this message]
2018-01-30  0:32 ` [PATCH 6/8] rockchip/rga: fix potential integer overflow in rga_buf_map Gustavo A. R. Silva
2018-01-30  0:32   ` Gustavo A. R. Silva
2018-01-30  0:33 ` [PATCH 7/8] platform: sh_veu: fix potential integer overflow in sh_veu_colour_offset Gustavo A. R. Silva
2018-01-30  0:33 ` [PATCH 8/8] platform: vivid-cec: fix potential integer overflow in vivid_cec_pin_adap_events Gustavo A. R. Silva
2018-01-30  7:21   ` Hans Verkuil
2018-01-30  8:51     ` Gustavo A. R. Silva
2018-01-30  9:57       ` Hans Verkuil
2018-01-30 10:55         ` Gustavo A. R. Silva
2018-01-30 11:15           ` Hans Verkuil
2018-01-30 11:43             ` Gustavo A. R. Silva
2018-01-30 11:50               ` Hans Verkuil
2018-01-30 11:57                 ` Gustavo A. R. Silva

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=7958c3115b5727c2272ce9cf7454cea8e6f4cc50.1517268668.git.gustavo@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=garsilva@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.