From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Fam Zheng <famz@redhat.com>
Subject: [Qemu-devel] [PULL 9/9] scsi-generic: Fill in opt_xfer_len in INQUIRY reply if it is zero
Date: Mon, 27 Mar 2017 18:16:15 +0200 [thread overview]
Message-ID: <20170327161615.19637-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20170327161615.19637-1-pbonzini@redhat.com>
From: Fam Zheng <famz@redhat.com>
When opt_xfer_len is zero, Linux ignores max_xfer_len erroneously.
While that obviously should be fixed, we do older guests a favor to
always filling in a value.
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20170327142625.1249-1-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/scsi-generic.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 2933119..a55ff87 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -237,9 +237,8 @@ static void scsi_read_complete(void * opaque, int ret)
assert(max_transfer);
stl_be_p(&r->buf[8], max_transfer);
/* Also take care of the opt xfer len. */
- if (ldl_be_p(&r->buf[12]) > max_transfer) {
- stl_be_p(&r->buf[12], max_transfer);
- }
+ stl_be_p(&r->buf[12],
+ MIN_NON_ZERO(max_transfer, ldl_be_p(&r->buf[12])));
}
scsi_req_data(&r->req, len);
scsi_req_unref(&r->req);
--
2.9.3
next prev parent reply other threads:[~2017-03-27 16:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 16:16 [Qemu-devel] [PULL 0/9] Misc fixes for QEMU 2.9.0-rc2 Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 1/9] clear pending status before calling memory commit Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 2/9] virtio-scsi: Make virtio_scsi_acquire/release public Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 3/9] virtio-scsi: Fix acquire/release in dataplane handlers Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 4/9] tcg/i386: Check the size of instruction being translated Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 5/9] mem-prealloc: fix sysconf(_SC_NPROCESSORS_ONLN) failure case Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 6/9] win32: replace custom mutex and condition variable with native primitives Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 7/9] nbd: drop unused NBDClientSession.is_unix field Paolo Bonzini
2017-03-27 16:16 ` [Qemu-devel] [PULL 8/9] Revert "apic: save apic_delivered flag" Paolo Bonzini
2017-03-27 16:16 ` Paolo Bonzini [this message]
2017-03-28 8:48 ` [Qemu-devel] [PULL 0/9] Misc fixes for QEMU 2.9.0-rc2 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170327161615.19637-10-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.