From 606cfc4d48bf936e2ab03449c1dbd7f40fcd9e35 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 27 May 2022 22:09:11 +0300 Subject: [PATCH] Ports: Remove spaces in specifier in 2 printf calls in acpica-tools port The specifiers are badly written and lead to a crash when using iASL. This happens because our printf doesn't understand how to handle a space between the percent symbol and the actual formatted type specifier after it. To fix this, we just remove the spaces in a new patch file. --- ...ompiler-warnings-on-dangling-pointer.patch | 2 +- ...debug-message-due-to-formatting-erro.patch | 2 +- ...-Fix-printf-bad-specifier-formatting.patch | 34 +++++++++++++++++++ Ports/acpica-tools/patches/ReadMe.md | 4 +++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch diff --git a/Ports/acpica-tools/patches/0001--Stop-compiler-warnings-on-dangling-pointer.patch b/Ports/acpica-tools/patches/0001--Stop-compiler-warnings-on-dangling-pointer.patch index b74e5a108d..ce61faa359 100644 --- a/Ports/acpica-tools/patches/0001--Stop-compiler-warnings-on-dangling-pointer.patch +++ b/Ports/acpica-tools/patches/0001--Stop-compiler-warnings-on-dangling-pointer.patch @@ -1,7 +1,7 @@ From bf6a3c66f9f4a536ad7bab3eb7f149c7062de851 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 27 May 2022 10:18:35 +0300 -Subject: [PATCH 1/2] Stop compiler warnings on dangling pointer +Subject: [PATCH 1/3] Stop compiler warnings on dangling pointer --- source/components/utilities/utdebug.c | 2 +- diff --git a/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-due-to-formatting-erro.patch b/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-due-to-formatting-erro.patch index 75dd32ae86..decc57a98a 100644 --- a/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-due-to-formatting-erro.patch +++ b/Ports/acpica-tools/patches/0002-Disable-sprintf-debug-message-due-to-formatting-erro.patch @@ -1,7 +1,7 @@ From a62c4eb1dcf574cd1f02224cd1120e3435864413 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 27 May 2022 10:19:35 +0300 -Subject: [PATCH 2/2] Disable sprintf debug message due to formatting errors +Subject: [PATCH 2/3] Disable sprintf debug message due to formatting errors --- source/compiler/dtfield.c | 6 +++--- diff --git a/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch b/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch new file mode 100644 index 0000000000..a9f7c3a726 --- /dev/null +++ b/Ports/acpica-tools/patches/0003-Fix-printf-bad-specifier-formatting.patch @@ -0,0 +1,34 @@ +From 0168b0f6eeaa6322b35681a19f4f9d36723955dc Mon Sep 17 00:00:00 2001 +From: Liav A +Date: Fri, 27 May 2022 22:00:38 +0300 +Subject: [PATCH 3/3] Fix printf bad specifier formatting + +--- + source/common/dmtable.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/source/common/dmtable.c b/source/common/dmtable.c +index 440c5fb..d722e3d 100644 +--- a/source/common/dmtable.c ++++ b/source/common/dmtable.c +@@ -977,7 +977,7 @@ AcpiDmLineHeader ( + { + if (ByteLength) + { +- AcpiOsPrintf ("[%3.3Xh %4.4d% 4d] %28s : ", ++ AcpiOsPrintf ("[%3.3Xh %4.4d %4d] %28s : ", + Offset, Offset, ByteLength, Name); + } + else +@@ -1011,7 +1011,7 @@ AcpiDmLineHeader2 ( + } + else + { +- AcpiOsPrintf ("%36s % 3d : ", ++ AcpiOsPrintf ("%36s %3d : ", + Name, Value); + } + } +-- +2.36.0 + diff --git a/Ports/acpica-tools/patches/ReadMe.md b/Ports/acpica-tools/patches/ReadMe.md index 12a63ef2d6..15e9b13c84 100644 --- a/Ports/acpica-tools/patches/ReadMe.md +++ b/Ports/acpica-tools/patches/ReadMe.md @@ -8,3 +8,7 @@ Use static variable to prevent using a dangling pointer from a previous stack tr ## `0002-Disable-sprintf-debug-message-due-to-formatting-erro.patch` Disable sprintf debug message with formatting issues. + +## `0003-Fix-printf-bad-specifier-formatting.patch` + +Fix sprintf specifier being written in a bad format leading to iASL to crash.