summaryrefslogtreecommitdiff
path: root/util/ifdtool
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2019-01-05 00:06:19 +0100
committerFelix Held <felix-coreboot@felixheld.de>2019-01-06 23:54:41 +0000
commit844eda0f3b69e8b724fdf14fc663f808f686037f (patch)
tree73bd34bf697c75e5e9bb2498be4bdd7954639af5 /util/ifdtool
parenta70ed00bc20a162cf2e13dfaafe80ea954fcfbef (diff)
util/ifdtool: Fix regions_collide() check
The old version was unnecessarily complex and allowed one region to include the other. Change-Id: Ibf7faf8103c8945b82c3962b5a7b82c3288b871f Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/30673 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'util/ifdtool')
-rw-r--r--util/ifdtool/ifdtool.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index ccd27d0dc4..69cd2a9fef 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -1153,11 +1153,8 @@ static int regions_collide(const region_t *r1, const region_t *r2)
if ((r1->size == 0) || (r2->size == 0))
return 0;
- if ( ((r1->base >= r2->base) && (r1->base <= r2->limit)) ||
- ((r1->limit >= r2->base) && (r1->limit <= r2->limit)) )
- return 1;
-
- return 0;
+ /* r1 should be either completely below or completely above r2 */
+ return !(r1->limit < r2->base || r1->base > r2->limit);
}
void new_layout(const char *filename, char *image, int size,