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>
This commit is contained in:
parent
5b8f2c7823
commit
f68e3bab9f
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue