summaryrefslogtreecommitdiff
path: root/kernel/debug
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-27 17:43:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-11-04 14:06:53 +0100
commitec214735bb113be747454812035b83010892e0d2 (patch)
treea5c093b67bcc52487a3b45aca94bffe90a20693f /kernel/debug
parent5a0c88567a5ebbe24ecb7828e200f63ed972718f (diff)
comedi: ni_tio: Fix overflow of the clock period
ni_tio_set_clock_src() stores the period of the clock source, which the user passes in nanoseconds, in picoseconds: counter->clock_period_ps = period_ns * 1000; period_ns is an unsigned int, so that the product is computed in 32 bits, although clock_period_ps is a u64. It wraps for periods above 4294967 ns, that is for external clocks slower than 233 Hz. INSN_CONFIG_GET_CLOCK_SRC then reports a wrong period, and ni_tio_set_sync_mode() decides on a wrong one: 4294968 ns become 704 ps, which is below the limit of 25 ns under which the alternate synchronization mode for fast clocks is switched on. The multiplication was done in 64 bits until the constant pico_per_nano, a uint64_t, was replaced by a literal. Widen again. Fixes: 3e90b1c7ebe9 ("staging: comedi: ni_tio: tidy up ni_tio_set_clock_src() and helpers") Cc: stable <stable@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Link: https://patch.msgid.link/20261027-llm-char-misc-comedi-v1-4-1899771ee15b@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/debug')
0 files changed, 0 insertions, 0 deletions