libvduse: Fix assignment in vring_set_avail_event
commit86e61e4233b8de44805914475669c0ca906809c0
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 22 Dec 2022 20:36:48 +0000 (22 21:36 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 11 Jan 2023 09:44:35 +0000 (11 10:44 +0100)
tree6a0fc523928d2f2baf9d21cd93da490e719da9b7
parent85899f8e6b3c4dae924a550778a8f594ecc37b33
libvduse: Fix assignment in vring_set_avail_event

Since the assignment is causing a compiler warning, fix it by using
memcpy instead.

  CC       libvduse.o
libvduse.c: In function â€˜vring_set_avail_event’:
libvduse.c:603:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasin]
  603 |     *((uint16_t *)&vq->vring.used->ring[vq->vring.num]) = htole16(val);
      |      ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Suggested-by: Xie Yongji <xieyongji@bytedance.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <4a0fe2a6436464473119fdbf0bc4076b36fbb37f.1671741278.git.marcel@holtmann.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
subprojects/libvduse/libvduse.c