From 568cbc0cdecdeac35903285e0cd97b5a535b8308 Mon Sep 17 00:00:00 2001 From: LP-HAW Date: Fri, 13 Oct 2023 18:19:41 +0200 Subject: [PATCH] sys/benchmark: fix integer overflow in benchmark_print_time() --- sys/benchmark/benchmark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/benchmark/benchmark.c b/sys/benchmark/benchmark.c index f5667cc304..ef7b6e7b44 100644 --- a/sys/benchmark/benchmark.c +++ b/sys/benchmark/benchmark.c @@ -26,7 +26,7 @@ void benchmark_print_time(uint32_t time, unsigned long runs, const char *name) { uint32_t full = (time / runs); - uint32_t div = (time - (full * runs)) * 1000 / runs; + uint32_t div = (uint32_t)(((uint64_t)(time - (full * runs))) * 1000 / runs); uint32_t per_sec = (uint32_t)(((uint64_t)US_PER_SEC * runs) / time);