summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-14 23:02:48 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-15 12:44:35 +0200
commit96d5d017b70e26605d2340f5a27707db4302b4df (patch)
treee27fb5ae598760b36bb7021184001157d7bbfe37
parent0f6f86338294899fcd0e8cd9961fafbf604fa197 (diff)
downloadserenity-96d5d017b70e26605d2340f5a27707db4302b4df.zip
Kernel: Remove copy_string_from_user() as it's no longer used
-rw-r--r--Kernel/Process.h5
-rw-r--r--Kernel/StdLib.cpp29
-rw-r--r--Kernel/StdLib.h2
3 files changed, 0 insertions, 36 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h
index df4102c5a5..58ecf484e1 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -986,11 +986,6 @@ inline ProcessID Thread::pid() const
#define VERIFY_NO_PROCESS_BIG_LOCK(process) \
VERIFY(!process->big_lock().own_lock());
-inline static String copy_string_from_user(const Kernel::Syscall::StringArgument& string)
-{
- return copy_string_from_user(string.characters, string.length);
-}
-
inline static KResultOr<NonnullOwnPtr<KString>> try_copy_kstring_from_user(const Kernel::Syscall::StringArgument& string)
{
Userspace<char const*> characters((FlatPtr)string.characters);
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp
index 4571c8b1ec..83874108eb 100644
--- a/Kernel/StdLib.cpp
+++ b/Kernel/StdLib.cpp
@@ -13,35 +13,6 @@
#include <Kernel/Memory/MemoryManager.h>
#include <Kernel/StdLib.h>
-String copy_string_from_user(const char* user_str, size_t user_str_size)
-{
- bool is_user = Kernel::Memory::is_user_range(VirtualAddress(user_str), user_str_size);
- if (!is_user)
- return {};
- Kernel::SmapDisabler disabler;
- void* fault_at;
- ssize_t length = Kernel::safe_strnlen(user_str, user_str_size, fault_at);
- if (length < 0) {
- dbgln("copy_string_from_user({:p}, {}) failed at {} (strnlen)", static_cast<const void*>(user_str), user_str_size, VirtualAddress { fault_at });
- return {};
- }
- if (length == 0)
- return String::empty();
-
- char* buffer;
- auto copied_string = StringImpl::create_uninitialized((size_t)length, buffer);
- if (!Kernel::safe_memcpy(buffer, user_str, (size_t)length, fault_at)) {
- dbgln("copy_string_from_user({:p}, {}) failed at {} (memcpy)", static_cast<const void*>(user_str), user_str_size, VirtualAddress { fault_at });
- return {};
- }
- return copied_string;
-}
-
-String copy_string_from_user(Userspace<const char*> user_str, size_t user_str_size)
-{
- return copy_string_from_user(user_str.unsafe_userspace_ptr(), user_str_size);
-}
-
Kernel::KResultOr<NonnullOwnPtr<Kernel::KString>> try_copy_kstring_from_user(Userspace<const char*> user_str, size_t user_str_size)
{
bool is_user = Kernel::Memory::is_user_range(VirtualAddress(user_str), user_str_size);
diff --git a/Kernel/StdLib.h b/Kernel/StdLib.h
index f43e1f5f15..642fbbfc41 100644
--- a/Kernel/StdLib.h
+++ b/Kernel/StdLib.h
@@ -18,8 +18,6 @@ namespace Syscall {
struct StringArgument;
}
-[[nodiscard]] String copy_string_from_user(const char*, size_t);
-[[nodiscard]] String copy_string_from_user(Userspace<const char*>, size_t);
[[nodiscard]] Kernel::KResultOr<NonnullOwnPtr<Kernel::KString>> try_copy_kstring_from_user(Userspace<const char*>, size_t);
[[nodiscard]] Optional<Time> copy_time_from_user(const timespec*);
[[nodiscard]] Optional<Time> copy_time_from_user(const timeval*);