armv7: paging: proper check if `pte_count` pages fit inside source frame starting...
authorSimon Gerber <simon.gerber@inf.ethz.ch>
Mon, 3 Oct 2016 15:14:14 +0000 (17:14 +0200)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Mon, 3 Oct 2016 15:14:14 +0000 (17:14 +0200)
Signed-off-by: Simon Gerber <simon.gerber@inf.ethz.ch>

kernel/arch/armv7/paging.c

index a7947b0..9a83451 100644 (file)
@@ -504,9 +504,8 @@ caps_map_l2(struct capability* dest,
     }
 
     // check offset within frame
-    if ((offset + BASE_PAGE_SIZE > get_size(src)) ||
+    if ((offset + pte_count * BASE_PAGE_SIZE > get_size(src)) ||
         ((offset % BASE_PAGE_SIZE) != 0)) {
-        panic("oops: frame offset invalid");
         return SYS_ERR_FRAME_OFFSET_INVALID;
     }