1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +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(); tv = kgettimeofday();
} }
int Process::sys$gettimeofday(timeval* tv) int Process::sys$gettimeofday(timeval* user_tv)
{ {
REQUIRE_PROMISE(stdio); REQUIRE_PROMISE(stdio);
if (!validate_write_typed(tv)) if (!validate_write_typed(user_tv))
return -EFAULT; return -EFAULT;
*tv = kgettimeofday(); auto tv = kgettimeofday();
copy_to_user(user_tv, &tv);
return 0; return 0;
} }