mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
Kernel: Make msync return EINVAL when regions are too large
As a small cleanup, this also makes `page_round_up` verify its precondition with `page_round_up_would_wrap` (which callers are expected to call), rather than having its own logic. Fixes #11297.
This commit is contained in:
committed by
Brian Gianforcaro
parent
615c2cbcce
commit
da6aef9fff
Notes:
sideshowbarker
2024-07-19 17:11:34 +09:00
Author: https://github.com/eggpi 🔰 Commit: https://github.com/SerenityOS/serenity/commit/da6aef9fff2 Pull-request: https://github.com/SerenityOS/serenity/pull/11380 Reviewed-by: https://github.com/bgianfo
@@ -31,10 +31,8 @@ constexpr bool page_round_up_would_wrap(FlatPtr x)
|
||||
|
||||
constexpr FlatPtr page_round_up(FlatPtr x)
|
||||
{
|
||||
FlatPtr rounded = (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1));
|
||||
// Rounding up >0xfffff000 wraps back to 0. That's never what we want.
|
||||
VERIFY(x == 0 || rounded != 0);
|
||||
return rounded;
|
||||
VERIFY(!page_round_up_would_wrap(x));
|
||||
return (((FlatPtr)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1));
|
||||
}
|
||||
|
||||
constexpr FlatPtr page_round_down(FlatPtr x)
|
||||
|
||||
Reference in New Issue
Block a user