1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

Kernel: Use Userspace<T> for the setsockopt syscall

This commit is contained in:
Brian Gianforcaro 2020-08-07 00:18:20 -07:00 committed by Andreas Kling
parent 9f685ac30a
commit 6920d5f423
7 changed files with 12 additions and 11 deletions

View file

@ -429,7 +429,7 @@ String IPv4Socket::absolute_path(const FileDescription&) const
return builder.to_string();
}
KResult IPv4Socket::setsockopt(int level, int option, const void* user_value, socklen_t user_value_size)
KResult IPv4Socket::setsockopt(int level, int option, Userspace<const void*> user_value, socklen_t user_value_size)
{
if (level != IPPROTO_IP)
return Socket::setsockopt(level, option, user_value, user_value_size);
@ -439,7 +439,7 @@ KResult IPv4Socket::setsockopt(int level, int option, const void* user_value, so
if (user_value_size < sizeof(int))
return KResult(-EINVAL);
int value;
if (!Process::current()->validate_read_and_copy_typed(&value, (const int*)user_value))
if (!Process::current()->validate_read_and_copy_typed(&value, static_ptr_cast<const int*>(user_value)))
return KResult(-EFAULT);
if (value < 0 || value > 255)
return KResult(-EINVAL);