io_timer: fix potential invalid memory access

This commit is contained in:
Beat Küng
2019-10-16 11:36:48 +02:00
parent 617f37afbf
commit 17551a99f8
2 changed files with 2 additions and 2 deletions
@@ -525,7 +525,7 @@ void io_timer_trigger(void)
irqstate_t flags = px4_enter_critical_section();
for (actions = 0; action_cache[actions] != 0 && actions < MAX_IO_TIMERS; actions++) {
for (actions = 0; actions < MAX_IO_TIMERS && action_cache[actions] != 0; actions++) {
_REG32(action_cache[actions], KINETIS_FTM_SYNC_OFFSET) |= FTM_SYNC;
}
@@ -559,7 +559,7 @@ void io_timer_trigger(void)
irqstate_t flags = px4_enter_critical_section();
for (actions = 0; action_cache[actions] != 0 && actions < MAX_IO_TIMERS; actions++) {
for (actions = 0; actions < MAX_IO_TIMERS && action_cache[actions] != 0; actions++) {
_REG32(action_cache[actions], STM32_GTIM_EGR_OFFSET) |= GTIM_EGR_UG;
}