[PATCH] lib: fwts_acpi_tables: fix the build fail on armhf

Ivan Hu ivan.hu at canonical.com
Thu Mar 28 07:25:24 UTC 2024


BugLink: https://bugs.launchpad.net/fwts/+bug/2059390

Currently, the update glib to libglib2.0-0t64 on armhf,
causes pointer-to-int-cast error, it seems build failed
with _FILE_OFFSET_BITS=64 on 32-bit.

fwts_acpi_tables.c:173:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  173 |         if ((mem = fwts_mmap((off_t)addr, sizeof(fwts_acpi_table_rsdp))) == FWTS_MAP_FAILED)

fwts_acpi_tables.c:486:53: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
  486 |         fwts_acpi_add_table("RSDP", rsdp, (uint64_t)(off_t)rsdp_addr, rsdp_len, FWTS_ACPI_TABLE_FROM_FIRMWARE);

change the off_t to long int to fix this, let's see if any
update for this.

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

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index e215f493..46a7ade1 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -170,7 +170,7 @@ static fwts_acpi_table_rsdp *fwts_acpi_get_rsdp(fwts_framework *fw, void *addr,
 		return NULL;
 	}
 
-	if ((mem = fwts_mmap((off_t)addr, sizeof(fwts_acpi_table_rsdp))) == FWTS_MAP_FAILED)
+	if ((mem = fwts_mmap((long int)addr, sizeof(fwts_acpi_table_rsdp))) == FWTS_MAP_FAILED)
 		return NULL;
 
 	if (fwts_safe_memcpy(rsdp, mem, sizeof(fwts_acpi_table_rsdp)) != FWTS_OK) {
@@ -483,7 +483,7 @@ static int fwts_acpi_load_tables_from_firmware(fwts_framework *fw)
 	if ((rsdp = fwts_acpi_get_rsdp(fw, rsdp_addr, &rsdp_len)) == NULL)
 		return FWTS_ERROR;
 
-	fwts_acpi_add_table("RSDP", rsdp, (uint64_t)(off_t)rsdp_addr, rsdp_len, FWTS_ACPI_TABLE_FROM_FIRMWARE);
+	fwts_acpi_add_table("RSDP", rsdp, (uint64_t)(long int)rsdp_addr, rsdp_len, FWTS_ACPI_TABLE_FROM_FIRMWARE);
 
 	/* Load any tables from XSDT if it's valid */
 	if (rsdp->xsdt_address) {
-- 
2.34.1




More information about the fwts-devel mailing list