acassis opened a new pull request, #20420:
URL: https://github.com/apache/nuttx/pull/20420
## Summary
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
## Impact
Avoid quick time overflow on systems with int equal 16-bit
## Testing
```
$ cdp1802-unknown-elf-sim --rom nuttx.elf.bin --rom-size 32768 --banks 16
--symbols nuttx.elf
NuttShell (NSH) NuttX-13.1.0-RC0
nsh> ?
?
help usage: help [-v] [<cmd>]
? help quit uptime
free poweroff ps
nsh> free
free
total used free maxused maxfree nused nfree name
14376 3576 10800 4512 10000 16 2 Umem
nsh>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]