diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2022-12-22 21:36:49 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2023-01-11 10:44:35 +0100 |
commit | 950a2f2eff1aa39620ff78be4485f6290939d8dd (patch) | |
tree | 7079c97e3848a21913955c5d6ff0e08eecdcc84a /subprojects/libvhost-user | |
parent | 86e61e4233b8de44805914475669c0ca906809c0 (diff) | |
download | qemu-950a2f2eff1aa39620ff78be4485f6290939d8dd.zip qemu-950a2f2eff1aa39620ff78be4485f6290939d8dd.tar.gz qemu-950a2f2eff1aa39620ff78be4485f6290939d8dd.tar.bz2 |
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>
Diffstat (limited to 'subprojects/libvhost-user')
-rw-r--r-- | subprojects/libvhost-user/libvhost-user.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index b28b66c..fc69783 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -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 |