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)
18
18
// the regions in the first place, but we have them here to make sure that
19
19
// we can't end up describing memory regions that don't make sense. They
20
20
// 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.
23
24
//
24
25
// Note: (base + size == 0) part of the assertion is to handle cases like
25
26
// { base = 0xffff_ffff_ffff_f000, size: 0x1000 }
26
27
return (size % PGSIZE == 0 ) &&
27
28
(base % PGSIZE == 0 ) &&
29
+ (size_t (size) == size) &&
28
30
(size > 0 ) &&
29
31
((base + size > base) || (base + size == 0 ));
30
32
}
You can’t perform that action at this time.
0 commit comments