From c4fca98299daa6256f80f1aff275ec6a6c9ed9f9 Mon Sep 17 00:00:00 2001 From: Sunmi Lee Date: Fri, 6 Jul 2018 17:39:03 +0900 Subject: [PATCH] [COMMON] fimc-is2: Fix a bug of devide by zero There is a possiblity to execute of dividing by zero in CALC_LNR_INTRPL. PR JIRA ID: CPR-39 Change-Id: Idb23bc03b5622b79dadc5ebac184a7bc8e4018c6 Signed-off-by: Sunmi Lee --- .../platform/exynos/fimc-is2/hardware/fimc-is-hw-uvsp-cac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-uvsp-cac.c b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-uvsp-cac.c index 85e3a25aa602..a45c3e122d86 100644 --- a/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-uvsp-cac.c +++ b/drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-uvsp-cac.c @@ -22,7 +22,7 @@ #define RSHFT(a) ((int)((a) >> INTRPL_SHFT_VAL)) #define NUMERATOR(Y1, Y2, DXn) (((Y2) - (Y1)) * (DXn)) #define CALC_LNR_INTRPL(Y1, Y2, X1, X2, X) (LSHFT(NUMERATOR(Y1, Y2, SUB(X, X1))) / SUB(X2, X1) + LSHFT(Y1)) -#define GET_LNR_INTRPL(Y1, Y2, X1, X2, X) RSHFT(CALC_LNR_INTRPL(Y1, Y2, X1, X2, X)) +#define GET_LNR_INTRPL(Y1, Y2, X1, X2, X) RSHFT(SUB(X2, X1) ? CALC_LNR_INTRPL(Y1, Y2, X1, X2, X) : LSHFT(Y1)) struct ref_ni { u32 min; -- 2.20.1