Skip to content
Commit feefb7dd authored by Akaiwa Wataru's avatar Akaiwa Wataru Committed by Benjamin Cabé
Browse files

kernel/sched: correct k_sleep() return value calculation

Fix the issue: https://github.com/zephyrproject-rtos/zephyr/issues/79863



The expected_wakeup_ticks and sys_clock_tick_get_32() are uint32_t values,
and may wrap around individually.
If the expected_wakeup_ticks has a wraparound and sys_clock_tick_get_32()
doesn't, so expected_wakeup_ticks < sys_clock_tick_get_32(), the API return
value will be corrupted.

The API return value, that is the remaining time, should be calculated in
32bit-unsigned-integer manner, and any wraparound will be treated properly.

Signed-off-by: default avatarAkaiwa Wataru <akaiwa@sonas.co.jp>
parent 4fb6ce39
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment