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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23640949.6Emhk5qWAg@rjwysocki.net>
Date: Thu, 29 Aug 2024 20:38:31 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux ACPI <linux-acpi@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Bob Moore <robert.moore@...el.com>,
 Saket Dumbre <saket.dumbre@...el.com>
Subject:
 [PATCH v1 13/20] ACPICA: Add support for supressing leading zeros in hex
 strings

From: Armin Wolf <W_Armin@....de>

ACPICA commit 86289439d9f8b9eda28c249da66ae230d6439491

Currently the leading_zeros argument has no effect when
converting hex integers. Fix that.

Link: https://github.com/acpica/acpica/commit/86289439
Signed-off-by: Armin Wolf <W_Armin@....de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
 drivers/acpi/acpica/exconvrt.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 4e8ab3c26565..9647325d290d 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -270,6 +270,7 @@ acpi_ex_convert_to_ascii(u64 integer,
 	u32 decimal_length;
 	u32 remainder;
 	u8 supress_zeros = !leading_zeros;
+	u8 hex_char;
 
 	ACPI_FUNCTION_ENTRY();
 
@@ -330,8 +331,17 @@ acpi_ex_convert_to_ascii(u64 integer,
 
 			/* Get one hex digit, most significant digits first */
 
-			string[k] = (u8)
+			hex_char = (u8)
 			    acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j));
+
+			/* Supress leading zeros until the first non-zero character */
+
+			if (hex_char == ACPI_ASCII_ZERO && supress_zeros) {
+				continue;
+			}
+
+			supress_zeros = FALSE;
+			string[k] = hex_char;
 			k++;
 		}
 		break;
-- 
2.43.0





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ