mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
media: platform: sh_veu: use 64-bit arithmetic instead of 32-bit
Cast left and top to dma_addr_t in order to give the compiler complete information about the proper arithmetic to use. Notice that these variables are being used in contexts that expect expressions of type dma_addr_t (64 bit, unsigned). Such expressions are currently being evaluated using 32-bit arithmetic. Also, move the expression (((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3) at the end in order to avoid a line wrapping checkpatch.pl warning. Addresses-Coverity-ID: 1056807 ("Unintentional integer overflow") Addresses-Coverity-ID: 1056808 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
8328ad0f82
commit
eb64311ffc
1 changed files with 2 additions and 2 deletions
|
@ -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)top * veu->vfmt_out.bytesperline +
|
||||
(((dma_addr_t)left * veu->vfmt_out.fmt->depth) >> 3);
|
||||
unsigned int y_line;
|
||||
|
||||
vfmt->offset_y = offset;
|
||||
|
|
Loading…
Reference in a new issue