]> git.proxmox.com Git - qemu.git/commitdiff
virtio-ccw: Fix unsetting of indicators.
authorCornelia Huck <cornelia.huck@de.ibm.com>
Wed, 5 Jun 2013 15:13:05 +0000 (17:13 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Thu, 6 Jun 2013 08:25:59 +0000 (10:25 +0200)
Interpretation of the ccws to register (configuration) indicators contained
a thinko: We want to disallow reading from 0, but setting the indicator
pointer to 0 is fine.

Let's fix the handling for CCW_CMD_SET{,_CONF}_IND.

Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/virtio-ccw.c

index 5f5e267558b1e4967f088c8164fd9b1499f698d7..44f5772bb2b5bbca7540b0b2c33a5fac65604eae 100644 (file)
@@ -328,10 +328,10 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
             ret = -EINVAL;
             break;
         }
-        indicators = ldq_phys(ccw.cda);
-        if (!indicators) {
+        if (!ccw.cda) {
             ret = -EFAULT;
         } else {
+            indicators = ldq_phys(ccw.cda);
             dev->indicators = indicators;
             sch->curr_status.scsw.count = ccw.count - sizeof(indicators);
             ret = 0;
@@ -348,10 +348,10 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
             ret = -EINVAL;
             break;
         }
-        indicators = ldq_phys(ccw.cda);
-        if (!indicators) {
+        if (!ccw.cda) {
             ret = -EFAULT;
         } else {
+            indicators = ldq_phys(ccw.cda);
             dev->indicators2 = indicators;
             sch->curr_status.scsw.count = ccw.count - sizeof(indicators);
             ret = 0;