File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,15 @@ bool mem_cfg_t::check_if_supported(reg_t base, reg_t size)
1818 // the regions in the first place, but we have them here to make sure that
1919 // we can't end up describing memory regions that don't make sense. They
2020 // ask that the page size is a multiple of the minimum page size, that the
21- // page is aligned to the minimum page size, that the page is non-empty and
22- // that the top address is still representable in a reg_t.
21+ // page is aligned to the minimum page size, that the page is non-empty,
22+ // that the size doesn't overflow size_t, and that the top address is still
23+ // representable in a reg_t.
2324 //
2425 // Note: (base + size == 0) part of the assertion is to handle cases like
2526 // { base = 0xffff_ffff_ffff_f000, size: 0x1000 }
2627 return (size % PGSIZE == 0 ) &&
2728 (base % PGSIZE == 0 ) &&
29+ (size_t (size) == size) &&
2830 (size > 0 ) &&
2931 ((base + size > base) || (base + size == 0 ));
3032}
You can’t perform that action at this time.
0 commit comments