[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access
From: |
Peter Maydell |
Subject: |
Re: [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access |
Date: |
Fri, 28 Jun 2024 16:20:02 +0100 |
On Thu, 27 Jun 2024 at 14:39, Akihiko Odaki <akihiko.odaki@daynix.com> 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));
> }
I did wonder if there was a better way to do what this is doing,
but neither we (in system/device_tree.c) nor libfdt seem to
provide one.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
- Re: [PATCH v2 02/15] hw/ide: Convert macio ide_irq into GPIO line, (continued)
- [PATCH v2 05/15] spapr: Free stdout path, Akihiko Odaki, 2024/06/27
- [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access, Akihiko Odaki, 2024/06/27
- Re: [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access,
Peter Maydell <=
- [PATCH v2 07/15] hw/virtio: Free vqs after vhost_dev_cleanup(), Akihiko Odaki, 2024/06/27
- [PATCH v2 08/15] migration: Free removed SaveStateEntry, Akihiko Odaki, 2024/06/27
- [PATCH v2 09/15] memory: Do not create circular reference with subregion, Akihiko Odaki, 2024/06/27
- [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full(), Akihiko Odaki, 2024/06/27
- [PATCH v2 11/15] tests/qtest: Free unused QMP response, Akihiko Odaki, 2024/06/27
- [PATCH v2 12/15] tests/qtest: Free old machine variable name, Akihiko Odaki, 2024/06/27
- [PATCH v2 13/15] tests/qtest: Delete previous boot file, Akihiko Odaki, 2024/06/27
- [PATCH v2 15/15] tests/qtest: Free GThread, Akihiko Odaki, 2024/06/27