From 33bb753e92560a73f04d0a8124908d90a2a74695 Mon Sep 17 00:00:00 2001 From: Seungchul Kim Date: Fri, 24 Nov 2017 15:02:51 +0900 Subject: [PATCH] [COMMON] media: smfc: fix prevent issue This patch fixed below prevent issue about other violation types. CID 201997, 201944, 200890, 200853 Change-Id: Icf94074d36c7d4526e13e25c9dc188875dabec77 Signed-off-by: Seungchul Kim --- drivers/media/platform/exynos/smfc/smfc-regs.c | 2 +- drivers/media/platform/exynos/smfc/smfc-stream-parser.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/exynos/smfc/smfc-regs.c b/drivers/media/platform/exynos/smfc/smfc-regs.c index ff7a82a1ee64..4ec5e1643a99 100644 --- a/drivers/media/platform/exynos/smfc/smfc-regs.c +++ b/drivers/media/platform/exynos/smfc/smfc-regs.c @@ -411,7 +411,7 @@ void smfc_hwconfigure_image(struct smfc_ctx *ctx, stream_address = smfc_hwconfigure_jpeg_base(ctx, &vb2buf_jpg->vb2_buf, ctx->offset_of_sos, false); if (!(ctx->flags & SMFC_CTX_COMPRESS)) { - u32 streamsize = vb2_plane_size(&vb2buf_jpg->vb2_buf, 0); + u32 streamsize = (u32)vb2_plane_size(&vb2buf_jpg->vb2_buf, 0); streamsize -= ctx->offset_of_sos; streamsize += stream_address & SMFC_ADDR_ALIGN_MASK(burstlen); diff --git a/drivers/media/platform/exynos/smfc/smfc-stream-parser.c b/drivers/media/platform/exynos/smfc/smfc-stream-parser.c index b2d09840a2a0..1db39b3f98db 100644 --- a/drivers/media/platform/exynos/smfc/smfc-stream-parser.c +++ b/drivers/media/platform/exynos/smfc/smfc-stream-parser.c @@ -155,7 +155,7 @@ static int smfc_parse_dht(struct smfc_ctx *ctx, unsigned long *cursor) table = dc ? ctx->huffman_tables->dc[tcth & 1].value : ctx->huffman_tables->ac[tcth & 1].value; ret = copy_from_user(table, pcursor, num_values); - pcursor += num_values; + pcursor += (unsigned long)num_values; if (ret) { dev_err(ctx->smfc->dev, "Failed to read huffval of %d,%d\n", @@ -205,7 +205,7 @@ static int smfc_parse_dqt(struct smfc_ctx *ctx, unsigned long *cursor) ret = copy_from_user(ctx->quantizer_tables->table[pqtq], pcursor, SMFC_MCU_SIZE); - pcursor += SMFC_MCU_SIZE; + pcursor += (unsigned long)SMFC_MCU_SIZE; if (ret) { dev_err(ctx->smfc->dev, "Failed to read %dth Q-Table\n", pqtq); @@ -303,7 +303,7 @@ static int smfc_parse_scanheader(struct smfc_ctx *ctx, pos = sos; - ctx->offset_of_sos = *cursor - streambase - SMFC_JPEG_MARKER_LEN; + ctx->offset_of_sos = (unsigned int)(*cursor - streambase - SMFC_JPEG_MARKER_LEN); ret = copy_from_user(sos, (void __user *)*cursor, sizeof(sos)); if (ret) { -- 2.20.1