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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 28 Oct 2021 00:34:44 +0000
From:   Yang Guang <cgel.zte@...il.com>
To:     Jarkko Sakkinen <jarkko@...nel.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Shuah Khan <shuah@...nel.org>
Cc:     Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>, linux-sgx@...r.kernel.org,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] selftest/sgx: use swap() to make code cleaner

Using swap() make it more readable.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Yang Guang <yang.guang5@....com.cn>
---
 tools/testing/selftests/sgx/sigstruct.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
index 92bbc5a15c39..47eb0749dba4 100644
--- a/tools/testing/selftests/sgx/sigstruct.c
+++ b/tools/testing/selftests/sgx/sigstruct.c
@@ -59,13 +59,10 @@ static void reverse_bytes(void *data, int length)
 {
 	int i = 0;
 	int j = length - 1;
-	uint8_t temp;
 	uint8_t *ptr = data;
 
 	while (i < j) {
-		temp = ptr[i];
-		ptr[i] = ptr[j];
-		ptr[j] = temp;
+		swap(ptr[i], ptr[j]);
 		i++;
 		j--;
 	}
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ