qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [PATCH] block/nvme: Remove QEMU_PACKED from naturally


From: Kevin Wolf
Subject: Re: [Qemu-trivial] [PATCH] block/nvme: Remove QEMU_PACKED from naturally aligned NVMeRegs struct
Date: Mon, 25 Feb 2019 15:09:35 +0100
User-agent: Mutt/1.11.3 (2019-02-01)

Am 25.02.2019 um 12:59 hat Thomas Huth geschrieben:
> The QEMU_PACKED is causing a compiler warning/error with GCC 9:
> 
>   CC      block/nvme.o
> block/nvme.c: In function ‘nvme_create_queue_pair’:
> block/nvme.c:209:22: error: taking address of packed member of
>  ‘struct <anonymous>’ may result in an unaligned pointer value
>  [-Werror=address-of-packed-member]
>   209 |     q->sq.doorbell = &s->regs->doorbells[idx * 2 * s->doorbell_scale];
> 
> All members of the struct are naturally aligned, so there should
> not be the need for QEMU_PACKED here, and the following QEMU_BUILD_BUG_ON
> also ensures that there is no padding. Thus simply remove the QEMU_PACKED
> here.
> 
> Buglink: https://bugs.launchpad.net/qemu/+bug/1817525
> Reported-by: Satheesh Rajendran <address@hidden>
> Signed-off-by: Thomas Huth <address@hidden>

Thanks, applied to the block branch.

Though I'm not sure why a compiler should warn if packed and non-packed
result in the exact same layout anyway...

Kevin



reply via email to

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