Skip to content

Commit

Permalink
clk: fix overflow_before_widen case
Browse files Browse the repository at this point in the history
This will fix integer overflow

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
  • Loading branch information
abonislawski committed Jul 11, 2024
1 parent f8924eb commit 84d4de2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ uint64_t clock_ticks_per_sample(int clock, uint32_t sample_rate)

platform_shared_get(clk_info, sizeof(*clk_info));
ticks_per_msec = clk_info->freqs[clk_info->current_freq_idx].ticks_per_msec;
ticks_per_sample = sample_rate ? ticks_per_msec * 1000 / sample_rate : 0;
ticks_per_sample = sample_rate ? ticks_per_msec * 1000ULL / sample_rate : 0;

return ticks_per_sample;
}

0 comments on commit 84d4de2

Please sign in to comment.