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.
This commit is contained in:
Brian Gianforcaro 2021-07-23 09:31:08 -07:00 committed by Andreas Kling
parent c2282ee28d
commit 9d8482c3e8
Notes: sideshowbarker 2024-07-18 08:28:54 +09:00

View file

@ -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; \
}