1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:18:12 +00:00

Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOr

This mostly just moved the problem, as a lot of the callers are not
capable of propagating the errors themselves, but it's a step in the
right direction.
This commit is contained in:
Idan Horowitz 2022-01-13 18:20:22 +02:00 committed by Andreas Kling
parent e2e5d4da16
commit fb3e46e930
14 changed files with 80 additions and 57 deletions

View file

@ -38,7 +38,7 @@ ErrorOr<size_t> MemoryDevice::read(OpenFileDescription&, u64 offset, UserOrKerne
dbgln("MemoryDevice: Trying to read physical memory at {} for range of {} bytes failed due to violation of access", PhysicalAddress(offset), length);
return EINVAL;
}
auto mapping = Memory::map_typed<u8>(PhysicalAddress(offset), length);
auto mapping = TRY(Memory::map_typed<u8>(PhysicalAddress(offset), length));
auto bytes = ReadonlyBytes { mapping.ptr(), length };
TRY(buffer.write(bytes));