Skip to content

Commit

Permalink
sys/benchmark: fix integer overflow in benchmark_print_time()
Browse files Browse the repository at this point in the history
  • Loading branch information
LP-HAW committed Oct 13, 2023
1 parent 3a4ec8d commit 568cbc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/benchmark/benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 568cbc0

Please sign in to comment.