diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index ffda8c4ccf..24f1f535af 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -90,22 +90,12 @@ KResult Socket::setsockopt(int level, int option, Userspace user_va case SO_SNDTIMEO: if (user_value_size != sizeof(timeval)) return EINVAL; - { - auto timeout = copy_time_from_user(static_ptr_cast(user_value)); - if (!timeout.has_value()) - return EFAULT; - m_send_timeout = timeout.value(); - } + m_send_timeout = TRY(copy_time_from_user(static_ptr_cast(user_value))); return KSuccess; case SO_RCVTIMEO: if (user_value_size != sizeof(timeval)) return EINVAL; - { - auto timeout = copy_time_from_user(static_ptr_cast(user_value)); - if (!timeout.has_value()) - return EFAULT; - m_receive_timeout = timeout.value(); - } + m_receive_timeout = TRY(copy_time_from_user(static_ptr_cast(user_value))); return KSuccess; case SO_BINDTODEVICE: { if (user_value_size != IFNAMSIZ) diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 5bb48ea2b0..68f4baa142 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -40,31 +40,28 @@ Kernel::KResultOr> try_copy_kstring_from_user(Use return new_string; } -[[nodiscard]] Optional