qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] loader: Fix misaligned member access


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] loader: Fix misaligned member access
Date: Mon, 23 Apr 2018 15:04:31 +0100

On 23 April 2018 at 14:57, Philippe Mathieu-Daudé <address@hidden> wrote:
> On 04/23/2018 12:16 AM, David Gibson wrote:
>> On Sun, Apr 22, 2018 at 11:41:20AM +0100, Peter Maydell wrote:
>>> If we need to do an unaligned load, then ldl_p() is the
>>> right way to do it. (We could also just do
>>>  *addr = ldl_be_p(prop) but we maybe don't want to
>>> bake in knowledge that FDT is big-endian).
>
> Since it is, ldl_be_p() seems the clever/cleaner way indeed, but then we
> assume we know the underlying type of fdt32_t; while using memcpy we
> respect the FDT API.

 *addr = fdt32_to_cpu(ldl_p(prop));

is better than a raw memcpy still.

thanks
-- PMM



reply via email to

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