[PATCH 2/2] gpio/gpio-support: Fix build warnings.

G S Niteesh Babu niteesh.gs at gmail.com
Sat Mar 28 10:50:07 UTC 2020


Fixes "array subscript is outside array bounds" in gpio-support.c
---
 bsps/shared/dev/gpio/gpio-support.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bsps/shared/dev/gpio/gpio-support.c b/bsps/shared/dev/gpio/gpio-support.c
index 9c053dc151..04f1c8ca90 100644
--- a/bsps/shared/dev/gpio/gpio-support.c
+++ b/bsps/shared/dev/gpio/gpio-support.c
@@ -325,6 +325,7 @@ static rtems_status_code get_pin_bitmask(
       ACQUIRE_LOCK(gpio_bank_state[bank].lock);
     }
     else if ( bank != *bank_number ) {
+      assert ( *bank_number >= 0 && *bank_number < GPIO_BANK_COUNT );
       RELEASE_LOCK(gpio_bank_state[*bank_number].lock);
 
       return RTEMS_UNSATISFIED;
-- 
2.17.1



More information about the devel mailing list