提交 c3a699be 编写于 作者: P Peter Maydell

hw/timer/exynos4210_mct: Avoid overflow in exynos4210_ltick_recalc_count

Add casts to avoid potentially overflowing the multiplications
of 32 bit quantities in exynos4210_ltick_recalc_count().
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Reviewed-by: NPeter Crosthwaite <peter.crosthwaite@xilinx.com>
上级 2a41c928
...@@ -818,14 +818,14 @@ static void exynos4210_ltick_recalc_count(struct tick_timer *s) ...@@ -818,14 +818,14 @@ static void exynos4210_ltick_recalc_count(struct tick_timer *s)
*/ */
if (s->last_tcnto) { if (s->last_tcnto) {
to_count = s->last_tcnto * s->last_icnto; to_count = (uint64_t)s->last_tcnto * s->last_icnto;
} else { } else {
to_count = s->last_icnto; to_count = s->last_icnto;
} }
} else { } else {
/* distance is passed, recalculate with tcnto * icnto */ /* distance is passed, recalculate with tcnto * icnto */
if (s->icntb) { if (s->icntb) {
s->distance = s->tcntb * s->icntb; s->distance = (uint64_t)s->tcntb * s->icntb;
} else { } else {
s->distance = s->tcntb; s->distance = s->tcntb;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册