summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-10-24 20:07:53 +0200
committerLioncash <mathew1800@gmail.com>2018-10-24 20:10:48 +0200
commit77328b0f1978f044f05a60cd864a4dff0c4b7493 (patch)
tree549f5c07cbb48a628dcf9a3f16a1afcf74b1f309 /src/core/hle/kernel
parentkernel/error: Add error code for invalid pointers (diff)
downloadyuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar.gz
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar.bz2
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar.lz
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar.xz
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.tar.zst
yuzu-77328b0f1978f044f05a60cd864a4dff0c4b7493.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/svc.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 9a783d524..e7e4c59b6 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -594,16 +594,17 @@ static ResultCode SetThreadPriority(Handle handle, u32 priority) {
}
const auto* const current_process = Core::CurrentProcess();
- SharedPtr<Thread> thread = current_process->GetHandleTable().Get<Thread>(handle);
- if (!thread) {
- return ERR_INVALID_HANDLE;
- }
// Note: The kernel uses the current process's resource limit instead of
// the one from the thread owner's resource limit.
const ResourceLimit& resource_limit = current_process->GetResourceLimit();
if (resource_limit.GetMaxResourceValue(ResourceType::Priority) > priority) {
- return ERR_NOT_AUTHORIZED;
+ return ERR_INVALID_THREAD_PRIORITY;
+ }
+
+ SharedPtr<Thread> thread = current_process->GetHandleTable().Get<Thread>(handle);
+ if (!thread) {
+ return ERR_INVALID_HANDLE;
}
thread->SetPriority(priority);