diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-16 11:21:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-16 11:34:01 +0200 |
commit | 426c4e387da02a12bb0a6271677a538d3f856f94 (patch) | |
tree | f3ec25932663008bad72a68a8185bdc24899494b | |
parent | 3a92d0828de6ffc040c6006a01a8710dd8a28bf7 (diff) | |
download | serenity-426c4e387da02a12bb0a6271677a538d3f856f94.zip |
Kernel: Use copy_to_user() in sys$gettimeofday()
-rw-r--r-- | Kernel/Process.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 6ed4f5105f..24dc7b9e4f 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -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; } |