From: Lv Zheng Date: Wed, 30 Jul 2014 04:21:07 +0000 (+0800) Subject: ACPICA: Utilities: Fix local printf issue. X-Git-Tag: v3.17-rc1~99^2~2^2~10 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3589b8b8af6bdc3aafe520d76a73b77d965006b6;p=uclinux-h8%2Flinux.git ACPICA: Utilities: Fix local printf issue. The bug can be reproduced by using a format that do not have the width.prec specified after a format that have the width.prec specified. The second formatted output will be wrong. The root cause is acpi_ut_vsnprintf() doesn't reset the specifiers to the default values. This patch fixes this issue. BZ 1094. Reported by Yizhe Wang, fixed by Lv Zheng. Since acpi_ut_vprintf() is only enabled for specific OSPM now, this patch doesn't affect Linux kernel. Link: https://bugs.acpica.org/show_bug.cgi?id=1094 Reported-and-tested-by: Yizhe Wang Signed-off-by: Lv Zheng Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c index 080e22aaba15..0ce3f5a0dd67 100644 --- a/drivers/acpi/acpica/utprint.c +++ b/drivers/acpi/acpica/utprint.c @@ -401,6 +401,7 @@ acpi_ut_vsnprintf(char *string, /* Process width */ + width = -1; if (ACPI_IS_DIGIT(*format)) { format = acpi_ut_scan_number(format, &number); width = (s32) number; @@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string, /* Process precision */ + precision = -1; if (*format == '.') { ++format; if (ACPI_IS_DIGIT(*format)) { @@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string, /* Process qualifier */ + qualifier = -1; if (*format == 'h' || *format == 'l' || *format == 'L') { qualifier = *format; ++format;