[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [virtio-dev] [PATCH v4 1/2] vhost-vsock: fix endianness problem
On Fri, 11 Mar 2016 17:45:23 +0100 Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> wrote: > 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(-) > Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com> > 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)); > } >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]