Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved Jacob Garber: Looks good to me, approved
board_enable: Work around -Wtype-limits issue

In case of an empty `board_matches` list (i.e. on non-x86), we checked
if the `unsigned i` is smaller 0. Shuffling the computation avoids that
problem.

Change-Id: I636d73c920a7b7e7507eafe444bab8236d7acb67
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35801
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
---
M board_enable.c
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board_enable.c b/board_enable.c
index 98d6fd0..a5980eb 100644
--- a/board_enable.c
+++ b/board_enable.c
@@ -2493,7 +2493,7 @@

int ret = 0;
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(board_matches) - 1; i++) {
+ for (i = 0; i + 1 < ARRAY_SIZE(board_matches); i++) {
const struct board_match *b = &board_matches[i];
if (b->vendor_name == NULL || b->board_name == NULL) {
msg_gerr("ERROR: Board enable #%d does not define a vendor and board name.\n"

To view, visit change 35801. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I636d73c920a7b7e7507eafe444bab8236d7acb67
Gerrit-Change-Number: 35801
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged