Aaron Durbin (adurbin@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13694
-gerrit
commit 4fac08b82b89d066510865c8dd05ce8da1817a3d Author: Aaron Durbin adurbin@chromium.org Date: Thu Feb 11 16:08:49 2016 -0600
soc/intel/apollolake: add assert for pad constraints
Ensure the pads passed into the gpio functions are within range.
Change-Id: Ic523cbfaf60a46709080347af3a36d6330f9a07c Signed-off-by: Aaron Durbin adurbin@chromium.org --- src/soc/intel/apollolake/gpio.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/soc/intel/apollolake/gpio.c b/src/soc/intel/apollolake/gpio.c index ab0e0ed..5a68878 100644 --- a/src/soc/intel/apollolake/gpio.c +++ b/src/soc/intel/apollolake/gpio.c @@ -10,6 +10,7 @@ * (at your option) any later version. */
+#include <assert.h> #include <soc/gpio.h> #include <soc/iosf.h>
@@ -37,6 +38,8 @@ static const struct pad_community *gpio_get_community(uint16_t pad) { const struct pad_community *map = gpio_communities;
+ assert(pad < TOTAL_PADS); + while (map->first_pad > pad) map++;