TARGET_NRF - Fix possible invalid comparison.

pull/2785/head
Vincent Coubard 2016-09-22 16:12:48 +01:00
parent 0e0cc2687a
commit 80740dda06
2 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks)
{
first_locked_mutex = i;
}
if ((i - first_locked_mutex + 1) == n_blocks)
if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t)(i - first_locked_mutex + 1)) == n_blocks)
{
return first_locked_mutex;
}

View File

@ -100,7 +100,7 @@ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks)
{
first_locked_mutex = i;
}
if ((i - first_locked_mutex + 1) == n_blocks)
if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t) (i - first_locked_mutex + 1)) == n_blocks)
{
return first_locked_mutex;
}