Skip to content

Commit

Permalink
ACPICA: Utilities: Fix local printf issue.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lv Zheng authored and Rafael J. Wysocki committed Jul 30, 2014
1 parent 83118b0 commit 3589b8b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/acpi/acpica/utprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string,

/* Process precision */

precision = -1;
if (*format == '.') {
++format;
if (ACPI_IS_DIGIT(*format)) {
Expand All @@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string,

/* Process qualifier */

qualifier = -1;
if (*format == 'h' || *format == 'l' || *format == 'L') {
qualifier = *format;
++format;
Expand Down

0 comments on commit 3589b8b

Please sign in to comment.