diff mbox series

lib: fwts_acpi_object_eval.: fix build fail for ppc64el on mantic

Message ID 20230825072700.84240-1-ivan.hu@canonical.com
State Accepted
Headers show
Series lib: fwts_acpi_object_eval.: fix build fail for ppc64el on mantic | expand

Commit Message

Ivan Hu Aug. 25, 2023, 7:27 a.m. UTC
BugLink: https://bugs.launchpad.net/fwts/+bug/2033015

Got format-overflow, "error:‘%s’ directive argument is null" for ppc64el on mantic as below,

fwts_acpi_object_eval.c:790:33: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  790 | "%s package element %" PRIu32 " was not the expected "
      | ^~~~~~~~~~~~~~~~~~~~~~
fwts_acpi_object_eval.c:790:34: note: format string is defined here
  790 | "%s package element %" PRIu32 " was not the expected "
      | ^~

fwts_acpi_object_eval.c: In function ‘fwts_method_package_elements_type__’:
fwts_acpi_object_eval.c:828:33: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  828 | "%s package element %" PRIu32 " (%s) was not the expected "
      | ^~~~~~~~~~~~~~~~~~~~~~
fwts_acpi_object_eval.c:828:34: note: format string is defined here
  828 | "%s package element %" PRIu32 " (%s) was not the expected "
      | ^~

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/src/fwts_acpi_object_eval.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/lib/src/fwts_acpi_object_eval.c b/src/lib/src/fwts_acpi_object_eval.c
index ece8fd98..24896bd6 100644
--- a/src/lib/src/fwts_acpi_object_eval.c
+++ b/src/lib/src/fwts_acpi_object_eval.c
@@ -789,7 +789,7 @@  int fwts_method_package_elements_all_type(
 			fwts_failed(fw, LOG_LEVEL_CRITICAL, tmp,
 				"%s package element %" PRIu32 " was not the expected "
 				"type '%s', was instead type '%s'.",
-				name, i,
+				name ? name : "unknown", i,
 				fwts_method_type_name(type),
 				fwts_method_type_name(obj->Package.Elements[i].Type));
 			failed = true;
@@ -827,7 +827,7 @@  int fwts_method_package_elements_type__(
 			fwts_failed(fw, LOG_LEVEL_CRITICAL, tmp,
 				"%s package element %" PRIu32 " (%s) was not the expected "
 				"type '%s', was instead type '%s'.",
-				name, i, info[i].name,
+				name ? name : "unknown", i, info[i].name,
 				fwts_method_type_name(info[i].type),
 				fwts_method_type_name(obj->Package.Elements[i].Type));
 			failed = true;