[PATCH 06/10] ACPICA: utilities: fix sprintf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: John Levon <john.levon@xxxxxxxxxx>

This commit contains changes for the following commit ID's:
8f99a6ccd3b8e5c3d3d68c53fdbb054c2477eeb4
d30647af53abd334cbcf6362387464ea647bac9e
d3c5fb4cf5b2880d789c987eb847fc3de3774abc

On 32-bit, the provided sprintf() is non-functional: with a size of
ACPI_UINT32_MAX, String + Size will wrap, meaning End < Start, and
acpi_ut_bound_string_output() will never output anything as a result.

The symptom we saw of this was acpixtract failing to output anything.

Link: https://github.com/acpica/acpica/commit/8f99a6cc
Link: https://github.com/acpica/acpica/commit/d30647af
Link: https://github.com/acpica/acpica/commit/d3c5fb4c
Signed-off-by: MSathieu <18145111+MSathieu@xxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: John Levon <john.levon@xxxxxxxxxx>
Signed-off-by: Bob Moore <robert.moore@xxxxxxxxx>
Signed-off-by: Erik Kaneda <erik.kaneda@xxxxxxxxx>
---
 drivers/acpi/acpica/utprint.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index a874dac7db5c..681c11f4af4e 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -332,7 +332,12 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
 	int i;
 
 	pos = string;
-	end = string + size;
+
+	if (size != ACPI_UINT32_MAX) {
+		end = string + size;
+	} else {
+		end = ACPI_CAST_PTR(char, ACPI_UINT32_MAX);
+	}
 
 	for (; *format; ++format) {
 		if (*format != '%') {
-- 
2.25.1




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux