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>
This commit is contained in:
Nico Huber 2019-01-05 00:06:19 +01:00 committed by Felix Held
parent a70ed00bc2
commit 844eda0f3b
1 changed files with 2 additions and 5 deletions

View File

@ -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,