usb-msc: support commands without payload

This lets the usb-msc driver send TEST UNIT READY commands.

Modified to avoid divide by zero by Kevin O'Connor <kevin@koconnor.net>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/src/usb-msc.c b/src/usb-msc.c
index 13ef93e..52b41b0 100644
--- a/src/usb-msc.c
+++ b/src/usb-msc.c
@@ -79,9 +79,11 @@
         goto fail;
 
     // Transfer data from device.
-    ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
-    if (ret)
-        goto fail;
+    if (bytes) {
+        ret = usb_send_bulk(bulkin, USB_DIR_IN, op->buf_fl, bytes);
+        if (ret)
+            goto fail;
+    }
 
     // Transfer csw info.
     struct csw_s csw;
@@ -95,7 +97,8 @@
     if (csw.bCSWStatus == 2)
         goto fail;
 
-    op->count -= csw.dCSWDataResidue / blocksize;
+    if (blocksize)
+        op->count -= csw.dCSWDataResidue / blocksize;
     return DISK_RET_EBADTRACK;
 
 fail: