summaryrefslogtreecommitdiff
path: root/util/ifdtool/ifdtool.c
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@puri.sm>2017-10-04 11:35:59 -0400
committerMartin Roth <martinroth@google.com>2017-10-22 01:51:17 +0000
commitf68e3bab9f2a9fd60bce2391c4a15c0e8b1641c4 (patch)
tree993cb713fa1b70969d5480d00be820de2abca3f1 /util/ifdtool/ifdtool.c
parent5b8f2c7823729a0185a25fd90f5741374a0dfe10 (diff)
downloadcoreboot-f68e3bab9f2a9fd60bce2391c4a15c0e8b1641c4.tar.xz
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 <youness.alaoui@puri.sm> Reviewed-on: https://review.coreboot.org/21962 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/ifdtool/ifdtool.c')
-rw-r--r--util/ifdtool/ifdtool.c4
1 files 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);
}