Attention is currently required from: Stefan Reinauer.
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/68694 )
Change subject: ifdtool: Introduce region_name_fmap ......................................................................
ifdtool: Introduce region_name_fmap
Instead of directly accessing the region_name array use a helper function.
Change-Id: Ifc810da1628cebd2728d0185502c462ff9428597 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M util/ifdtool/ifdtool.c 1 file changed, 24 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/68694/1
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 9f771cf..3d57e02 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -358,6 +358,16 @@ return region_names[region_type].pretty; }
+static const char *region_name_fmap(unsigned int region_type) +{ + if (region_type >= max_regions) { + fprintf(stderr, "Invalid region type.\n"); + exit (EXIT_FAILURE); + } + + return region_names[region_type].fmapname; +} + static const char *region_name_short(unsigned int region_type) { if (region_type >= max_regions) { @@ -1025,7 +1035,7 @@ fmap = (struct fmap *)(image + fmap_loc);
for (i = 0; i < max_regions; i++) { - if (region_names[i].fmapname == NULL) + if (region_name_fmap(i) == NULL) continue;
region_t region = get_region(frba, i); @@ -1034,7 +1044,7 @@ continue;
const struct fmap_area *area = - fmap_find_area(fmap, region_names[i].fmapname); + fmap_find_area(fmap, region_name_fmap(i));
if (!area) continue;