[coreboot-gerrit] Change in coreboot[master]: lib/gpio.c: Validate num_gpio
Richard Spiegel (Code Review)
gerrit at coreboot.org
Tue Aug 21 01:59:16 CEST 2018
Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/28249
Change subject: lib/gpio.c: Validate num_gpio
......................................................................
lib/gpio.c: Validate num_gpio
In function _gpio_base3_value(), if num_gpio is 0 it'll cause the return
of an undefined value, as no for loop will be executed. Assert that it's
not 0.
BUG=b:112253891
TEST=Build and boot grunt.
Change-Id: I2b6537900fa41ebbee0171959f3ce236d360bc80
Signed-off-by: Richard Spiegel <richard.spiegel at silverbackltd.com>
---
M src/lib/gpio.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/28249/1
diff --git a/src/lib/gpio.c b/src/lib/gpio.c
index 0656dfb..482f62d 100644
--- a/src/lib/gpio.c
+++ b/src/lib/gpio.c
@@ -82,7 +82,7 @@
int index;
int temp;
char value[32];
- assert(num_gpio <= 32);
+ assert((num_gpio <= 32) && (num_gpio > 0));
/* Enable internal pull up */
for (index = 0; index < num_gpio; ++index)
--
To view, visit https://review.coreboot.org/28249
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b6537900fa41ebbee0171959f3ce236d360bc80
Gerrit-Change-Number: 28249
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel at silverbackltd.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180820/421058ad/attachment.html>
More information about the coreboot-gerrit
mailing list