From: Markus Armbruster Date: Wed, 29 Jan 2014 17:47:39 +0000 (+0100) Subject: scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7ef8cf9a0861b6f67f5e57428478c31bfd811651;p=qemu.git scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b The transfer length depends on field BYTCHK, which is encoded in byte 1, bits 1..2. However, the guard for for case BYTCHK=11b doesn't work, and we get case 01b instead. Fix it. Note that since emulated scsi-hd fails the command outright, it takes SCSI passthrough of a device that actually implements VERIFY with BYTCHK=11b to make the bug bite. Screwed up in commit d12ad44. Spotted by Coverity. Cc: qemu-stable@nongnu.org Signed-off-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 054a7d407a..50a0acf1fe 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -909,7 +909,7 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf) case VERIFY_16: if ((buf[1] & 2) == 0) { cmd->xfer = 0; - } else if ((buf[1] & 4) == 1) { + } else if ((buf[1] & 4) != 0) { cmd->xfer = 1; } cmd->xfer *= dev->blocksize;