1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

Kernel: Use Userspace<T> for sys$read() and sys$stat()

Add validation helper overloads as needed.
This commit is contained in:
Andreas Kling 2020-07-31 16:28:37 +02:00
parent e39a410546
commit 314dbc10d4
5 changed files with 67 additions and 7 deletions

View file

@ -29,7 +29,7 @@
namespace Kernel {
ssize_t Process::sys$read(int fd, u8* buffer, ssize_t size)
ssize_t Process::sys$read(int fd, Userspace<u8*> buffer, ssize_t size)
{
REQUIRE_PROMISE(stdio);
if (size < 0)
@ -56,7 +56,8 @@ ssize_t Process::sys$read(int fd, u8* buffer, ssize_t size)
return -EAGAIN;
}
}
return description->read(buffer, size);
// FIXME: We should have a read() that takes a Userspace<u8*>
return description->read((u8*)buffer.ptr(), size);
}
}