Skip to content

Commit bb89a79

Browse files
John Levonrafaeljw
authored andcommitted
ACPICA: utilities: fix sprintf()
This contains changes for the following ACPICA 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: acpica/acpica@8f99a6cc Link: acpica/acpica@d30647af Link: acpica/acpica@d3c5fb4c Signed-off-by: MSathieu <[email protected]> Signed-off-by: John Levon <[email protected]> Signed-off-by: Bob Moore <[email protected]> Signed-off-by: Erik Kaneda <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent f2173c3 commit bb89a79

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/acpi/acpica/utprint.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,12 @@ int vsnprintf(char *string, acpi_size size, const char *format, va_list args)
332332
int i;
333333

334334
pos = string;
335-
end = string + size;
335+
336+
if (size != ACPI_UINT32_MAX) {
337+
end = string + size;
338+
} else {
339+
end = ACPI_CAST_PTR(char, ACPI_UINT32_MAX);
340+
}
336341

337342
for (; *format; ++format) {
338343
if (*format != '%') {

0 commit comments

Comments
 (0)