Received: from eggs.gnu.org ([2001:4830:134:3::10]:35818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukrm1-0003Sh-8l for qemu-devel@nongnu.org; Fri, 07 Jun 2013 04:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukrlx-0006Rx-JZ for qemu-devel@nongnu.org; Fri, 07 Jun 2013 04:11:49 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:33631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukrlx-0006Rj-AK for qemu-devel@nongnu.org; Fri, 07 Jun 2013 04:11:45 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Jun 2013 09:06:59 +0100 From: Cornelia Huck Date: Fri, 7 Jun 2013 10:11:16 +0200 Message-Id: <1370592676-22532-3-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1370592676-22532-1-git-send-email-cornelia.huck@de.ibm.com> References: <1370592676-22532-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL 2/2] virtio-ccw: Fix unsetting of indicators. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Blue Swirl , Cornelia Huck , Anthony Liguori , qemu-stable@nongnu.org, =?UTF-8?q?Aur=C3=A9lien=20Jarno?= 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 --- hw/s390x/virtio-ccw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 5f5e267..44f5772 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -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; -- 1.7.9.5