From: Paolo Bonzini Date: Mon, 14 Jan 2013 15:26:56 +0000 (+0100) Subject: ide: fix TRIM with empty range entry X-Git-Tag: qemu-xen-4.4.0-rc1~6^2~1400^2~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=80bc2e8d807939bee89d1a5ca0dbe89946d39ed1;p=qemu-upstream-4.4-testing.git ide: fix TRIM with empty range entry ATA-ACS-3 says "If the two byte range length is zero, then the LBA Range Entry shall be discarded as padding." iovecs are used as if they are linearized, so it is incorrect to discard the rest of this iovec. Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- diff --git a/hw/ide/core.c b/hw/ide/core.c index 6f1938a0a..cb77dfcd4 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -374,7 +374,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs, uint16_t count = entry >> 48; if (count == 0) { - break; + continue; } ret = bdrv_discard(bs, sector, count);