summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-07-23 09:31:08 -0700
committerAndreas Kling <kling@serenityos.org>2021-07-23 19:02:25 +0200
commit9d8482c3e8f0dd4cc050e1e9ec64a8ff51eba97e (patch)
tree3f40138ff4057a712ebc86a9b38fb9efc23132cf /Kernel/Syscalls
parentc2282ee28de37380107360318797f20fdc4cc276 (diff)
downloadserenity-9d8482c3e8f0dd4cc050e1e9ec64a8ff51eba97e.zip
Kernel: Use StringView when parsing pledges in sys$pledge(..)
This ensures no potential allocation as in some cases the pledge char* could be promoted to AK::String by the compiler to execute the comparison.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/pledge.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Syscalls/pledge.cpp b/Kernel/Syscalls/pledge.cpp
index 4b83e4e541..885b1317a1 100644
--- a/Kernel/Syscalls/pledge.cpp
+++ b/Kernel/Syscalls/pledge.cpp
@@ -39,7 +39,7 @@ KResultOr<FlatPtr> Process::sys$pledge(Userspace<const Syscall::SC_pledge_params
auto parts = pledge_spec.split_view(' ');
for (auto& part : parts) {
#define __ENUMERATE_PLEDGE_PROMISE(x) \
- if (part == #x) { \
+ if (part == StringView { #x }) { \
mask |= (1u << (u32)Pledge::x); \
continue; \
}