From cb167ea38843eb8ff09833f7a70fe43c2fb13215 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 2 Aug 2020 12:06:39 -0700 Subject: [PATCH] Kernel: Use for-each loops in unveil syscall --- Kernel/Syscalls/unveil.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Kernel/Syscalls/unveil.cpp b/Kernel/Syscalls/unveil.cpp index b9f82fdf85..466d50ed79 100644 --- a/Kernel/Syscalls/unveil.cpp +++ b/Kernel/Syscalls/unveil.cpp @@ -71,8 +71,8 @@ int Process::sys$unveil(Userspace user_params) return -EFAULT; unsigned new_permissions = 0; - for (size_t i = 0; i < permissions.length(); ++i) { - switch (permissions[i]) { + for (const char permission : permissions) { + switch (permission) { case 'r': new_permissions |= UnveiledPath::Access::Read; break; @@ -90,8 +90,7 @@ int Process::sys$unveil(Userspace user_params) } } - for (size_t i = 0; i < m_unveiled_paths.size(); ++i) { - auto& unveiled_path = m_unveiled_paths[i]; + for (auto& unveiled_path : m_unveiled_paths) { if (unveiled_path.path == new_unveiled_path) { if (new_permissions & ~unveiled_path.permissions) return -EPERM;