From f68e3bab9f2a9fd60bce2391c4a15c0e8b1641c4 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Wed, 4 Oct 2017 11:35:59 -0400 Subject: [PATCH] util/ifdtool: Fix region limitation check Using ifdtool to change layout on a 'ifd v2' file causes an error about region type 5 not being valid. The limit to check against is dynamic depending on ifd version, not static. Change-Id: Id4cdce4eac18fb0d171d1bdfa2044340bf93056a Signed-off-by: Youness Alaoui Reviewed-on: https://review.coreboot.org/21962 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- util/ifdtool/ifdtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 645175e16b..8397f5c157 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -171,7 +171,7 @@ static region_t get_region(const frba_t *frba, unsigned int region_type) limit_mask = base_mask << 16; - if (region_type >= MAX_REGIONS) { + if (region_type >= max_regions) { fprintf(stderr, "Invalid region type %d.\n", region_type); exit (EXIT_FAILURE); } @@ -190,7 +190,7 @@ static region_t get_region(const frba_t *frba, unsigned int region_type) static void set_region(frba_t *frba, unsigned int region_type, const region_t *region) { - if (region_type >= MAX_REGIONS_OLD) { + if (region_type >= max_regions) { fprintf(stderr, "Invalid region type %u.\n", region_type); exit (EXIT_FAILURE); }