aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-07-17 16:40:46 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-07-17 22:27:16 +0100
commite94cce1ad1183afa39c1f01e9b49345ddb1a0404 (patch)
tree43dcd8e391446a50e7dbb14de6349b9efa8b1b8a /com32/lib
parentd2f94e74fbd60bf491753895d2474105efb3dedf (diff)
downloadsyslinux-e94cce1ad1183afa39c1f01e9b49345ddb1a0404.tar.gz
syslinux-e94cce1ad1183afa39c1f01e9b49345ddb1a0404.tar.xz
syslinux-e94cce1ad1183afa39c1f01e9b49345ddb1a0404.zip
movebits: allow allocation across region boundary
It's OK to allocate across some region boundaries, provided that the region types are compatible. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/syslinux/movebits.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/com32/lib/syslinux/movebits.c b/com32/lib/syslinux/movebits.c
index 8ffdc630..85852e75 100644
--- a/com32/lib/syslinux/movebits.c
+++ b/com32/lib/syslinux/movebits.c
@@ -142,6 +142,18 @@ static void free_movelist(struct syslinux_movelist **parentptr)
delete_movelist(parentptr);
}
+static bool valid_type_combination(enum syslinux_memmap_types type1,
+ enum syslinux_memmap_types type2)
+{
+ if (type1 != SMT_FREE && type1 != SMT_TERMINAL)
+ return false;
+
+ if (type2 != SMT_FREE && type2 != SMT_TERMINAL)
+ return false;
+
+ return true;
+}
+
/*
* Scan the freelist looking for a particular chunk of memory
*/
@@ -167,7 +179,10 @@ static const struct syslinux_memmap *is_free_zone(const struct syslinux_memmap
}
return NULL; /* Not free */
} else if (llast >= start) {
- return NULL; /* Crosses region boundary */
+ if (valid_type_combination(list->type, list->next->type))
+ return list;
+
+ return NULL; /* Crosses incompatible region boundary */
}
}
list = list->next;