libvhost-user: Fix assignment in vring_set_avail_event

Since it was proposed to change the code in libvduse.c to use memcpy
instead of an assignment, the code in libvhost-user.c should also be
changed to use memcpy.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <502b22723264db064e4b05008233a9c1f2f8aaaa.1671741278.git.marcel@holtmann.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marcel Holtmann 2022-12-22 21:36:49 +01:00 committed by Paolo Bonzini
parent 86e61e4233
commit 950a2f2eff

View File

@ -2478,14 +2478,13 @@ vring_used_flags_unset_bit(VuVirtq *vq, int mask)
static inline void
vring_set_avail_event(VuVirtq *vq, uint16_t val)
{
uint16_t *avail;
uint16_t val_le = htole16(val);
if (!vq->notification) {
return;
}
avail = (uint16_t *)&vq->vring.used->ring[vq->vring.num];
*avail = htole16(val);
memcpy(&vq->vring.used->ring[vq->vring.num], &val_le, sizeof(uint16_t));
}
void