Received: from eggs.gnu.org ([208.118.235.92]:57111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfAWc-0003zB-Td for qemu-devel@nongnu.org; Thu, 14 Jun 2012 09:55:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfAWV-0002fX-1b for qemu-devel@nongnu.org; Thu, 14 Jun 2012 09:55:50 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:44150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfAWU-0002eW-NR for qemu-devel@nongnu.org; Thu, 14 Jun 2012 09:55:42 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jun 2012 14:55:39 +0100 Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5EDtaJT2580572 for ; Thu, 14 Jun 2012 14:55:36 +0100 Received: from d06av12.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5EDtWLx012937 for ; Thu, 14 Jun 2012 07:55:33 -0600 From: Christian Borntraeger Date: Thu, 14 Jun 2012 15:55:29 +0200 Message-Id: <1339682129-1497-6-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1339682129-1497-1-git-send-email-borntraeger@de.ibm.com> References: <1339682129-1497-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 5/5] scsi: Ensure command and transfer lengths are set for all SCSI stream commands. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com Cc: stefanha@gmail.com, Christian Hoff , qemu-devel@nongnu.org, Christian Borntraeger From: Christian Hoff scsi-generic relies on those values to be correct, so it is important that those values are initialized properly prior to submitting the SCSI command. Signed-off-by: Christian Hoff Signed-off-by: Christian Borntraeger --- hw/scsi-bus.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index 9854321..3c3f190 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -817,7 +817,11 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu switch (buf[0]) { /* stream commands */ case ERASE_12: + cmd->len = 12; + cmd->xfer = 0; + break; case ERASE_16: + cmd->len = 16; cmd->xfer = 0; break; case READ_6: @@ -836,9 +840,12 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu cmd->xfer = 0; break; case SPACE_16: + cmd->len = 16; cmd->xfer = buf[13] | (buf[12] << 8); break; case READ_POSITION: + cmd->len = 10; + switch (buf[1] & 0x1f) /* operation code */ { case SHORT_FORM_BLOCK_ID: case SHORT_FORM_VENDOR_SPECIFIC: @@ -856,6 +863,7 @@ static int scsi_req_stream_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *bu break; case FORMAT_UNIT: + cmd->len = 6; cmd->xfer = buf[4] | (buf[3] << 8); break; /* generic commands */ -- 1.7.0.4