diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-07-30 00:21:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-07-30 18:50:23 -0400 |
commit | 3589b8b8af6bdc3aafe520d76a73b77d965006b6 (patch) | |
tree | a62376b1c3225aa5ef39e22fce0bef558d59c7ad /drivers/acpi | |
parent | 83118b0de3a84c4728822abf6ce60bf6c8d1dbce (diff) |
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 <yizhe.wang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/utprint.c | 3 |
1 files changed, 3 insertions, 0 deletions
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, | |||
401 | 401 | ||
402 | /* Process width */ | 402 | /* Process width */ |
403 | 403 | ||
404 | width = -1; | ||
404 | if (ACPI_IS_DIGIT(*format)) { | 405 | if (ACPI_IS_DIGIT(*format)) { |
405 | format = acpi_ut_scan_number(format, &number); | 406 | format = acpi_ut_scan_number(format, &number); |
406 | width = (s32) number; | 407 | width = (s32) number; |
@@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string, | |||
415 | 416 | ||
416 | /* Process precision */ | 417 | /* Process precision */ |
417 | 418 | ||
419 | precision = -1; | ||
418 | if (*format == '.') { | 420 | if (*format == '.') { |
419 | ++format; | 421 | ++format; |
420 | if (ACPI_IS_DIGIT(*format)) { | 422 | if (ACPI_IS_DIGIT(*format)) { |
@@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string, | |||
431 | 433 | ||
432 | /* Process qualifier */ | 434 | /* Process qualifier */ |
433 | 435 | ||
436 | qualifier = -1; | ||
434 | if (*format == 'h' || *format == 'l' || *format == 'L') { | 437 | if (*format == 'h' || *format == 'l' || *format == 'L') { |
435 | qualifier = *format; | 438 | qualifier = *format; |
436 | ++format; | 439 | ++format; |