提交 3589b8b8 编写于 作者: L Lv Zheng 提交者: Rafael J. Wysocki

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=1094Reported-and-tested-by: NYizhe Wang <yizhe.wang@intel.com>
Signed-off-by: NLv Zheng <lv.zheng@intel.com>
Signed-off-by: NBob Moore <robert.moore@intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 83118b0d
...@@ -401,6 +401,7 @@ acpi_ut_vsnprintf(char *string, ...@@ -401,6 +401,7 @@ acpi_ut_vsnprintf(char *string,
/* Process width */ /* Process width */
width = -1;
if (ACPI_IS_DIGIT(*format)) { if (ACPI_IS_DIGIT(*format)) {
format = acpi_ut_scan_number(format, &number); format = acpi_ut_scan_number(format, &number);
width = (s32) number; width = (s32) number;
...@@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string, ...@@ -415,6 +416,7 @@ acpi_ut_vsnprintf(char *string,
/* Process precision */ /* Process precision */
precision = -1;
if (*format == '.') { if (*format == '.') {
++format; ++format;
if (ACPI_IS_DIGIT(*format)) { if (ACPI_IS_DIGIT(*format)) {
...@@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string, ...@@ -431,6 +433,7 @@ acpi_ut_vsnprintf(char *string,
/* Process qualifier */ /* Process qualifier */
qualifier = -1;
if (*format == 'h' || *format == 'l' || *format == 'L') { if (*format == 'h' || *format == 'l' || *format == 'L') {
qualifier = *format; qualifier = *format;
++format; ++format;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册