[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/29] libvhost-user: Fix assignment in vring_set_avail_event
From: |
Paolo Bonzini |
Subject: |
[PULL 25/29] libvhost-user: Fix assignment in vring_set_avail_event |
Date: |
Tue, 10 Jan 2023 17:02:29 +0100 |
From: Marcel Holtmann <marcel@holtmann.org>
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>
---
subprojects/libvhost-user/libvhost-user.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/subprojects/libvhost-user/libvhost-user.c
b/subprojects/libvhost-user/libvhost-user.c
index b28b66cdb159..fc69783d2bf6 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
--
2.38.1
- [PULL 13/29] tests: add G_GNUC_PRINTF for various functions, (continued)
- [PULL 13/29] tests: add G_GNUC_PRINTF for various functions, Paolo Bonzini, 2023/01/10
- [PULL 16/29] libvhost-user: Provide _GNU_SOURCE when compiling outside of QEMU, Paolo Bonzini, 2023/01/10
- [PULL 18/29] libvhost-user: Cast rc variable to avoid compiler warning, Paolo Bonzini, 2023/01/10
- [PULL 19/29] libvhost-user: Use unsigned int i for some for-loop iterations, Paolo Bonzini, 2023/01/10
- [PULL 28/29] target/i386: fix operand size of unary SSE operations, Paolo Bonzini, 2023/01/10
- [PULL 20/29] libvhost-user: Declare uffdio_register early to make it C90 compliant, Paolo Bonzini, 2023/01/10
- [PULL 29/29] configure: remove backwards-compatibility code, Paolo Bonzini, 2023/01/10
- [PULL 27/29] libvduse: Add extra compiler warnings, Paolo Bonzini, 2023/01/10
- [PULL 23/29] libvduse: Switch to unsigned int for inuse field in struct VduseVirtq, Paolo Bonzini, 2023/01/10
- [PULL 26/29] libvhost-user: Add extra compiler warnings, Paolo Bonzini, 2023/01/10
- [PULL 25/29] libvhost-user: Fix assignment in vring_set_avail_event,
Paolo Bonzini <=
- Re: [PULL 00/29] Misc patches for 2023-01-10, Peter Maydell, 2023/01/10