From e8ec1e908dd63e686b085751fad04cfb5088f614 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 15 Sep 2021 23:49:08 -0700 Subject: [PATCH] Kernel: Only instantiate main_program_metadata in the scope it's needed pvs-studio flagged this as a potential perf optimization. --- Kernel/Syscalls/execve.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 477c92464f1..ac0529ab87e 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -454,8 +454,6 @@ KResult Process::do_exec(NonnullRefPtr main_program_descrip auto new_process_name = TRY(KString::try_create(parts.last())); auto new_main_thread_name = TRY(new_process_name->try_clone()); - auto main_program_metadata = main_program_description->metadata(); - auto load_result = TRY(load(main_program_description, interpreter_description, main_program_header)); // NOTE: We don't need the interpreter executable description after this point. @@ -488,6 +486,7 @@ KResult Process::do_exec(NonnullRefPtr main_program_descrip bool executable_is_setid = false; if (!(main_program_description->custody()->mount_flags() & MS_NOSUID)) { + auto main_program_metadata = main_program_description->metadata(); if (main_program_metadata.is_setuid()) { executable_is_setid = true; ProtectedDataMutationScope scope { *this };