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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822044630.1267500-1-yanzhen@vivo.com>
Date: Thu, 22 Aug 2024 12:46:30 +0800
From: Yan Zhen <yanzhen@...o.com>
To: shuah@...nel.org
Cc: linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	opensource.kernel@...o.com,
	Yan Zhen <yanzhen@...o.com>
Subject: [PATCH v1] selftests:tdx:Use min macro

Using the min macro is usually more intuitive and readable.

Signed-off-by: Yan Zhen <yanzhen@...o.com>
---
 tools/testing/selftests/tdx/tdx_guest_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/tdx/tdx_guest_test.c b/tools/testing/selftests/tdx/tdx_guest_test.c
index 81d8cb88e..d7ddf5307 100644
--- a/tools/testing/selftests/tdx/tdx_guest_test.c
+++ b/tools/testing/selftests/tdx/tdx_guest_test.c
@@ -118,7 +118,7 @@ static void print_array_hex(const char *title, const char *prefix_str,
 	printf("\t\t%s", title);
 
 	for (j = 0; j < len; j += rowsize) {
-		line_len = rowsize < (len - j) ? rowsize : (len - j);
+		line_len = min((len - j), rowsize);
 		printf("%s%.8x:", prefix_str, j);
 		for (i = 0; i < line_len; i++)
 			printf(" %.2x", ptr[j + i]);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ