OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH v4 1/2] vhost-vsock: fix endianness problem


Use the proper endianness-aware virtio accessor functions to initialize the
vsock config space struct fields.

Explicitly initialize the struct to zero, in case new members are added later.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
---
 hw/virtio/vhost-vsock.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index b7c9453..2483da7 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -14,6 +14,7 @@
 #include <sys/ioctl.h>
 #include "qemu/osdep.h"
 #include "hw/virtio/virtio-bus.h"
+#include "hw/virtio/virtio-access.h"
 #include "migration/migration.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-vsock.h"
@@ -37,12 +38,10 @@ struct virtio_vsock_config {
 static void vhost_vsock_get_config(VirtIODevice *vdev, uint8_t *config)
 {
     VHostVSock *vsock = VHOST_VSOCK(vdev);
+    struct virtio_vsock_config vsockcfg = {};
 
-    /* TODO endianness? */
-    struct virtio_vsock_config vsockcfg = {
-        .guest_cid = vsock->conf.guest_cid,
-        .max_virtqueue_pairs = 1,
-    };
+    virtio_stl_p(vdev, &vsockcfg.guest_cid, vsock->conf.guest_cid);
+    virtio_stl_p(vdev, &vsockcfg.max_virtqueue_pairs, 1);
     memcpy(config, &vsockcfg, sizeof(vsockcfg));
 }
 
-- 
1.9.1



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]