mirror of https://lore.kernel.org/lkml/
 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 7/8] platform: sh_veu: fix potential integer overflow in sh_veu_colour_offset
Date: Mon, 29 Jan 2018 18:33:01 -0600	[thread overview]
Message-ID: <81bc1c8fa08d1643fa9b7b6630fdd42baed7d225.1517268668.git.gustavo@embeddedor.com> (raw)
In-Reply-To: <cover.1517268667.git.gustavo@embeddedor.com>

Cast left and top to dma_addr_t in order to avoid a potential integer
overflow. This variable is being used in a context that expects an
expression of type dma_addr_t (u64).

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

diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
index 976ea0b..e2795d0 100644
--- a/drivers/media/platform/sh_veu.c
+++ b/drivers/media/platform/sh_veu.c
@@ -520,8 +520,8 @@ static void sh_veu_colour_offset(struct sh_veu_dev *veu, struct sh_veu_vfmt *vfm
 	/* dst_left and dst_top validity will be verified in CROP / COMPOSE */
 	unsigned int left = vfmt->frame.left & ~0x03;
 	unsigned int top = vfmt->frame.top;
-	dma_addr_t offset = ((left * veu->vfmt_out.fmt->depth) >> 3) +
-		top * veu->vfmt_out.bytesperline;
+	dma_addr_t offset = (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) +
+			    (dma_addr_t)top * veu->vfmt_out.bytesperline;
 	unsigned int y_line;
 
 	vfmt->offset_y = offset;
-- 
2.7.4

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  1:07 [PATCH resend 0/8] fix potential integer overflows 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 ` [PATCH 5/8] pci: cx88-input: fix potential integer overflow Gustavo A. R. Silva
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:33 ` Gustavo A. R. Silva [this message]
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=81bc1c8fa08d1643fa9b7b6630fdd42baed7d225.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®