From deb4aece9a400c9559f8e3de297c6192e94425d3 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 11 Mar 2021 12:53:17 -0800 Subject: [PATCH] kern: fix inverted conditional in KDebugBase::SetThreadContext --- libraries/libmesosphere/source/kern_k_debug_base.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/libmesosphere/source/kern_k_debug_base.cpp b/libraries/libmesosphere/source/kern_k_debug_base.cpp index c41c87f13..7e9d61557 100644 --- a/libraries/libmesosphere/source/kern_k_debug_base.cpp +++ b/libraries/libmesosphere/source/kern_k_debug_base.cpp @@ -557,8 +557,12 @@ namespace ams::kern { /* Verify that the thread's svc state is valid. */ if (thread->IsCallingSvc()) { - R_UNLESS(thread->GetSvcId() != svc::SvcId_Break, svc::ResultInvalidState()); - R_UNLESS(thread->GetSvcId() != svc::SvcId_ReturnFromException, svc::ResultInvalidState()); + const u8 svc_id = thread->GetSvcId(); + + const bool is_valid_svc = svc_id == svc::SvcId_Break || + svc_id == svc::SvcId_ReturnFromException; + + R_UNLESS(is_valid_svc, svc::ResultInvalidState()); } /* Set the thread context. */