Index: hw/scsi-disk.c =================================================================== RCS file: /sources/qemu/qemu/hw/scsi-disk.c,v retrieving revision 1.13 diff -u -p -r1.13 scsi-disk.c --- hw/scsi-disk.c 29 Aug 2006 04:52:16 -0000 1.13 +++ hw/scsi-disk.c 22 Apr 2007 13:11:49 -0000 @@ -356,7 +356,7 @@ int32_t scsi_send_command(SCSIDevice *s, if (len < 36) { BADF("Inquiry buffer too small (%d)\n", len); } - memset(outbuf, 0, 36); + memset(outbuf, 0, len); if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) { outbuf[0] = 5; outbuf[1] = 0x80; @@ -374,7 +374,7 @@ int32_t scsi_send_command(SCSIDevice *s, outbuf[4] = 32; /* Sync data transfer and TCQ. */ outbuf[7] = 0x10 | (s->tcq ? 0x02 : 0); - r->buf_len = 36; + r->buf_len = len; break; case 0x16: DPRINTF("Reserve(6)\n"); @@ -440,6 +440,10 @@ int32_t scsi_send_command(SCSIDevice *s, p += 21; } r->buf_len = p - outbuf; + for(;r->buf_lenbuf_len++) + { + *p++=0; + } outbuf[0] = r->buf_len - 4; if (r->buf_len > len) r->buf_len = len;