mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
Kernel: Propagate overflow errors from Memory::page_round_up
Fixes #11402.
This commit is contained in:
parent
11599a3342
commit
33b78915d3
Notes:
sideshowbarker
2024-07-17 22:09:47 +09:00
Author: https://github.com/eggpi 🔰
Commit: 33b78915d3
Pull-request: https://github.com/SerenityOS/serenity/pull/11433
Issue: https://github.com/SerenityOS/serenity/issues/11402
Reviewed-by: https://github.com/awesomekling
31 changed files with 112 additions and 100 deletions
|
@ -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() };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue