From 26006cc2176a8478414f5264d08b6755b4d52931 Mon Sep 17 00:00:00 2001 From: "Evie (Ivi) Ballou" Date: Tue, 27 Jan 2026 03:18:20 +0200 Subject: [PATCH] util/ifdtool: show overlapping region name and range details When updating regions using a flashrom file with overlapping regions the error message now shows overlapping region names and their ranges. e.g: Regions would overlap: IE : 7fff000-7ffffff 10GbE_0 : 7fff000-7ffffff Change-Id: Ie2417e477924f0085839306a8a51d1241e20a338 Signed-off-by: Evie (Ivi) Ballou Reviewed-on: https://review.coreboot.org/c/coreboot/+/90940 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- util/ifdtool/ifdtool.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index 0592785bf6..c741e1d7c5 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -2094,7 +2094,18 @@ static void new_layout(const char *filename, char *image, int size, for (j = i + 1; j < max_regions; j++) { if (regions_collide(&new_regions[i], &new_regions[j])) { - fprintf(stderr, "Regions would overlap.\n"); + fprintf(stderr, "Regions would overlap:\n"); + + /* See which string is longer and make sure we pad the shorter one */ + int region_name_len_i = strlen(region_name(i)); + int region_name_len_j = strlen(region_name(j)); + int padding = MAX(region_name_len_i, region_name_len_j); + + /* Print the regions that overlap, and where each region is */ + fprintf(stderr, " %*s : %x-%x\n", padding, region_name(i), + new_regions[i].base, new_regions[i].limit); + fprintf(stderr, " %*s : %x-%x\n", padding, region_name(j), + new_regions[j].base, new_regions[j].limit); exit(EXIT_FAILURE); } }