1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +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

@ -27,6 +27,7 @@
#pragma once
#include <AK/Forward.h>
#include <AK/Userspace.h>
namespace Syscall {
struct StringArgument;
@ -69,3 +70,16 @@ inline void copy_to_user(T* dest, const T* src)
{
copy_to_user(dest, src, sizeof(T));
}
template<typename T>
inline void copy_from_user(T* dest, Userspace<const T*> src)
{
copy_from_user(dest, (const T*)src.ptr(), sizeof(T));
}
template<typename T>
inline void copy_to_user(Userspace<T*> dest, const T* src)
{
copy_to_user((T*)dest.ptr(), src, sizeof(T));
}