x86_64: pmap_map: Fixed size check to actually work for sizes >4GB.
authorSimon Gerber <simon.gerber@hp.com>
Wed, 23 Jul 2014 01:00:58 +0000 (18:00 -0700)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Mon, 4 May 2015 09:28:13 +0000 (11:28 +0200)
Conflicts:
lib/barrelfish/target/x86_64/pmap_target.c

Signed-off-by: Simon Gerber <simon.gerber@hp.com>

lib/barrelfish/target/x86_64/pmap_target.c

index 316c4cf..7e5c9c5 100644 (file)
@@ -329,6 +329,12 @@ static errval_t do_map(struct pmap_x86 *pmap, genvaddr_t vaddr,
     size_t pte_count = DIVIDE_ROUND_UP(size, page_size);
     genvaddr_t vend = vaddr + size;
 
+    if (offset+size > (1ULL<<fi.bits)) {
+        debug_printf("do_map: offset=%zu; size=%zu; frame size=%zu\n",
+                offset, size, ((size_t)1<<fi.bits));
+        return LIB_ERR_PMAP_FRAME_SIZE;
+    }
+
 #if 0
     if (debug_out) {
         genpaddr_t paddr = fi.base + offset;