[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/8] libvhost-user: fix -Waddress-of-packed-member
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/8] libvhost-user: fix -Waddress-of-packed-member |
Date: |
Fri, 10 May 2019 16:00:56 +0200 |
From: Marc-André Lureau <address@hidden>
/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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
contrib/libvhost-user/libvhost-user.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/libvhost-user/libvhost-user.c
b/contrib/libvhost-user/libvhost-user.c
index e08d6c7b9741..dcf4a969f238 100644
--- a/contrib/libvhost-user/libvhost-user.c
+++ b/contrib/libvhost-user/libvhost-user.c
@@ -542,7 +542,7 @@ static bool
vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
{
int i;
- VhostUserMemory *memory = &vmsg->payload.memory;
+ VhostUserMemory m = vmsg->payload.memory, *memory = &m;
dev->nregions = memory->nregions;
DPRINT("Nregions: %d\n", memory->nregions);
@@ -684,7 +684,7 @@ static bool
vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
{
int i;
- VhostUserMemory *memory = &vmsg->payload.memory;
+ VhostUserMemory m = vmsg->payload.memory, *memory = &m;
for (i = 0; i < dev->nregions; i++) {
VuDevRegion *r = &dev->regions[i];
@@ -813,7 +813,7 @@ vu_set_vring_num_exec(VuDev *dev, VhostUserMsg *vmsg)
static bool
vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)
{
- struct vhost_vring_addr *vra = &vmsg->payload.addr;
+ struct vhost_vring_addr addr = vmsg->payload.addr, *vra = &addr;
unsigned int index = vra->index;
VuVirtq *vq = &dev->vq[index];
--
2.18.1
- [Qemu-devel] [PULL 0/8] Input 20190510 patches, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 1/8] libvhost-user: fix -Waddress-of-packed-member,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 7/8] virtio-input-host-pci: cleanup types, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 3/8] Add vhost-user-backend, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 2/8] libvhost-user: add PROTOCOL_F_CONFIG if {set, get}_config, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 8/8] virtio-input: fix Kconfig dependency and Makefile, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 5/8] util: simplify unix_listen(), Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 4/8] Add vhost-user-input-pci, Gerd Hoffmann, 2019/05/10
- [Qemu-devel] [PULL 6/8] contrib: add vhost-user-input, Gerd Hoffmann, 2019/05/10
- Re: [Qemu-devel] [PULL 0/8] Input 20190510 patches, Peter Maydell, 2019/05/10