mirror of
https://github.com/apache/nuttx.git
synced 2026-10-04 12:48:09 +00:00
clock_get_sched_ticks() stored the value of read_seqbegin(), a uint32_t, in an unsigned int and passed it back to read_seqretry(). Where int is 16 bits the copy is truncated, so once the 32-bit sequence number passes 65535 read_seqretry() always reports a change and the loop never ends. The sequence advances once per tick, so after 65536 ticks (11 minutes at 100 Hz) the next caller, the timer interrupt itself, spins forever with interrupts disabled and the system stops. Seen on the CDP1802 (16-bit int): NSH stopped answering after 55 minutes at 20 Hz. AVR has the same problem. hrtimer's readers of the same lock already use uint32_t. Don't assume int is 32-bit :-D Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com> Assisted-by: Claude Opus 5.5 (claude-opus-5-5) |
||
|---|---|---|
| .. | ||
| clock.c | ||
| clock.h | ||
| clock_adjtime.c | ||
| clock_delay.c | ||
| clock_getres.c | ||
| clock_gettime.c | ||
| clock_initialize.c | ||
| clock_notifier.c | ||
| clock_perf.c | ||
| clock_realtime2absticks.c | ||
| clock_sched_ticks.c | ||
| clock_settime.c | ||
| clock_systime_ticks.c | ||
| clock_systime_timespec.c | ||
| clock_timekeeping.c | ||
| clock_timekeeping.h | ||
| CMakeLists.txt | ||
| Make.defs | ||