qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/14] ppc/vof: Fix unaligned FDT property access


From: Akihiko Odaki
Subject: Re: [PATCH 05/14] ppc/vof: Fix unaligned FDT property access
Date: Thu, 27 Jun 2024 22:12:26 +0900
User-agent: Mozilla Thunderbird

On 2024/06/26 21:03, Philippe Mathieu-Daudé wrote:
On 26/6/24 13:06, Akihiko Odaki wrote:
FDT properties are aligned by 4 bytes, not 8 bytes.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
  hw/ppc/vof.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index e3b430a81f4f..b5b6514d79fc 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -646,7 +646,7 @@ static void vof_dt_memory_available(void *fdt, GArray *claimed, uint64_t base)
      mem0_reg = fdt_getprop(fdt, offset, "reg", &proplen);
      g_assert(mem0_reg && proplen == sizeof(uint32_t) * (ac + sc));
      if (sc == 2) {
-        mem0_end = be64_to_cpu(*(uint64_t *)(mem0_reg + sizeof(uint32_t) * ac));
+        mem0_end = ldq_be_p(mem0_reg + sizeof(uint32_t) * ac);
      } else {
          mem0_end = be32_to_cpu(*(uint32_t *)(mem0_reg + sizeof(uint32_t) * ac));

OK but please keep API uses consistent, so convert other uses please.

This is the only unaligned access.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]