mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +00:00
Kernel: Propagate overflow errors from Memory::page_round_up
Fixes #11402.
This commit is contained in:
committed by
Andreas Kling
parent
11599a3342
commit
33b78915d3
@@ -38,18 +38,11 @@ VirtualRange VirtualRange::intersect(VirtualRange const& other) const
|
||||
|
||||
ErrorOr<VirtualRange> VirtualRange::expand_to_page_boundaries(FlatPtr address, size_t size)
|
||||
{
|
||||
if (page_round_up_would_wrap(size))
|
||||
return EINVAL;
|
||||
|
||||
if ((address + size) < address)
|
||||
return EINVAL;
|
||||
|
||||
if (page_round_up_would_wrap(address + size))
|
||||
return EINVAL;
|
||||
|
||||
auto base = VirtualAddress { address }.page_base();
|
||||
auto end = page_round_up(address + size);
|
||||
|
||||
auto end = TRY(page_round_up(address + size));
|
||||
return VirtualRange { base, end - base.get() };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user