qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

libvhost-user: fix -Waddress-of-packed-member

/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_mem_table_exec_postcopy’:
/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:546:31: warning: taking address of packed member of ‘struct VhostUserMsg’ may result in an unaligned pointer value [-Waddress-of-packed-member]
546 | VhostUserMemory *memory = &vmsg->payload.memory;
| ^~~~~~~~~~~~~~~~~~~~~
/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_mem_table_exec’:
/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:688:31: warning: taking address of packed member of ‘struct VhostUserMsg’ may result in an unaligned pointer value [-Waddress-of-packed-member]
688 | VhostUserMemory *memory = &vmsg->payload.memory;
| ^~~~~~~~~~~~~~~~~~~~~
/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c: In function ‘vu_set_vring_addr_exec’:
/home/elmarco/src/qemu/contrib/libvhost-user/libvhost-user.c:817:36: warning: taking address of packed member of ‘struct VhostUserMsg’ may result in an unaligned pointer value [-Waddress-of-packed-member]
817 | struct vhost_vring_addr *vra = &vmsg->payload.addr;
| ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20190503130034.24916-2-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Marc-André Lureau and committed by
Gerd Hoffmann
d288eef3 812b835f

+3 -3
+3 -3
contrib/libvhost-user/libvhost-user.c
··· 542 542 vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) 543 543 { 544 544 int i; 545 - VhostUserMemory *memory = &vmsg->payload.memory; 545 + VhostUserMemory m = vmsg->payload.memory, *memory = &m; 546 546 dev->nregions = memory->nregions; 547 547 548 548 DPRINT("Nregions: %d\n", memory->nregions); ··· 684 684 vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg) 685 685 { 686 686 int i; 687 - VhostUserMemory *memory = &vmsg->payload.memory; 687 + VhostUserMemory m = vmsg->payload.memory, *memory = &m; 688 688 689 689 for (i = 0; i < dev->nregions; i++) { 690 690 VuDevRegion *r = &dev->regions[i]; ··· 813 813 static bool 814 814 vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg) 815 815 { 816 - struct vhost_vring_addr *vra = &vmsg->payload.addr; 816 + struct vhost_vring_addr addr = vmsg->payload.addr, *vra = &addr; 817 817 unsigned int index = vra->index; 818 818 VuVirtq *vq = &dev->vq[index]; 819 819