[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] virtio-ccw: assure be accesses for set-revi
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] virtio-ccw: assure be accesses for set-revision |
Date: |
Wed, 11 Mar 2015 13:39:33 +0100 |
On Wed, 11 Mar 2015 10:57:51 +0100
Cornelia Huck <address@hidden> wrote:
> All fields in structures transmitted by ccws are big endian; assure
> we handle them as such for the set-revision ccw as well.
>
> Should be merged into "s390x/virtio-ccw: add virtio set-revision call".
>
> CC: Thomas Huth <address@hidden>
> Signed-off-by: Cornelia Huck <address@hidden>
> ---
> hw/s390x/virtio-ccw.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 60f8a14..a64f116 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -687,7 +687,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
> break;
> case CCW_CMD_SET_VIRTIO_REV:
> len = sizeof(revinfo);
> - if (ccw.count < len || (check_len && ccw.count > len)) {
> + if (ccw.count < sizeof(revinfo)) {
> ret = -EINVAL;
> break;
> }
> @@ -695,7 +695,18 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
> ret = -EFAULT;
> break;
> }
> - cpu_physical_memory_read(ccw.cda, &revinfo, len);
> + revinfo.revision = lduw_be_phys(&address_space_memory, ccw.cda);
> + revinfo.length = lduw_be_phys(&address_space_memory,
> + ccw.cda + sizeof(revinfo.revision));
> + if (ccw.count < len + revinfo.length ||
> + (check_len && ccw.count > len + revinfo.length)) {
> + ret = -EINVAL;
> + break;
> + }
> + /*
> + * Once we start to support revisions with additional data, we'll
> + * need to fetch it here. Nothing to do for now, though.
> + */
> if (dev->revision >= 0 ||
> revinfo.revision > virtio_ccw_rev_max(dev)) {
> ret = -ENOSYS;
Looks fine to me.
Reviewed-by: Thomas Huth <address@hidden>
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, (continued)
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Michael S. Tsirkin, 2015/03/10
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Cornelia Huck, 2015/03/10
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Michael S. Tsirkin, 2015/03/10
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Cornelia Huck, 2015/03/10
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Michael S. Tsirkin, 2015/03/10
- Re: [Qemu-devel] [PATCH] virtio: avoid leading underscores for helpers, Cornelia Huck, 2015/03/10
- [Qemu-devel] [PATCH] virtio: legacy features callback, Cornelia Huck, 2015/03/10
- [Qemu-devel] [PATCH 0/2] virtio-ccw: be accesses, Cornelia Huck, 2015/03/11
- [Qemu-devel] [PATCH 1/2] virtio-ccw: assure BE accesses, Cornelia Huck, 2015/03/11
- [Qemu-devel] [PATCH 2/2] virtio-ccw: assure be accesses for set-revision, Cornelia Huck, 2015/03/11
- Re: [Qemu-devel] [PATCH 2/2] virtio-ccw: assure be accesses for set-revision,
Thomas Huth <=