lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251210130035.545132-1-thorsten.blum@linux.dev>
Date: Wed, 10 Dec 2025 14:00:35 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Jarkko Sakkinen <jarkko@...nel.org>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	x86@...nel.org,
	"H. Peter Anvin" <hpa@...or.com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	linux-sgx@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] x86/sgx: Use goto to remove redundant if check in sgx_encl_init

Immediately break out of both loops when 'ret != SGX_UNMASKED_EVENT'
instead of checking for the same condition again in the outer loop.

Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
 arch/x86/kernel/cpu/sgx/ioctl.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 9322a9287dc7..c1e9841685e8 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -521,15 +521,10 @@ static int sgx_encl_init(struct sgx_encl *encl, struct sgx_sigstruct *sigstruct,
 
 			preempt_enable();
 
-			if (ret == SGX_UNMASKED_EVENT)
-				continue;
-			else
-				break;
+			if (ret != SGX_UNMASKED_EVENT)
+				goto skip_loop;
 		}
 
-		if (ret != SGX_UNMASKED_EVENT)
-			break;
-
 		msleep_interruptible(SGX_EINIT_SLEEP_TIME);
 
 		if (signal_pending(current)) {
@@ -538,6 +533,7 @@ static int sgx_encl_init(struct sgx_encl *encl, struct sgx_sigstruct *sigstruct,
 		}
 	}
 
+skip_loop:
 	if (encls_faulted(ret)) {
 		if (encls_failed(ret))
 			ENCLS_WARN(ret, "EINIT");
-- 
Thorsten Blum <thorsten.blum@...ux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ