1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Kernel: Use copy_to_user() in sys$gettimeofday()

This commit is contained in:
Andreas Kling 2020-05-16 11:21:12 +02:00
parent 3a92d0828d
commit 426c4e387d

View file

@ -2331,12 +2331,13 @@ void kgettimeofday(timeval& tv)
tv = kgettimeofday();
}
int Process::sys$gettimeofday(timeval* tv)
int Process::sys$gettimeofday(timeval* user_tv)
{
REQUIRE_PROMISE(stdio);
if (!validate_write_typed(tv))
if (!validate_write_typed(user_tv))
return -EFAULT;
*tv = kgettimeofday();
auto tv = kgettimeofday();
copy_to_user(user_tv, &tv);
return 0;
}