On 11 March 2014 12:29, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 10 March 2014 19:56, Michael S. Tsirkin <m...@redhat.com> wrote:
>> casting an unaligned address to e.g.
>> uint32_t can trigger undefined behaviour in C.
>> Replace cast + assignment with memcpy.
>>
>> Reported-by: Peter Maydell <peter.mayd...@linaro.org>
>> Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
>
> This does fix the clang warnings.

I missed that there's still one more warning generated by a
different bit of this file:

/home/petmay01/linaro/qemu-for-merges/hw/i386/acpi-build.c:1022:5:
runtime error: store to misaligned address 0x2b5aa47dfb19 for type
'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
0x2b5aa47dfb19: note: pointer points here
 45 53 54  0b ff ff 5b 80 50 45 4f  52 01 50 45 53 54 01 5b  81 0b 50
45 4f 52 01 50  45 50 54 08 14
              ^

    *(uint16_t *)(ssdt_ptr + *ssdt_isa_pest) =
        cpu_to_le16(misc->pvpanic_port);

in build_ssdt(). You could change that to:
    stw_le_p(ssdt_ptr + *ssdt_isa_pest, misc->pvpanic_port);
(untested).

thanks
-- PMM

Reply via email to