From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] scsi-bus: fix endianness bug in store_lun()
Date: Sat, 16 Mar 2013 09:13:38 +0100 [thread overview]
Message-ID: <514429B2.4010207@redhat.com> (raw)
In-Reply-To: <1363418170-3391-1-git-send-email-aik@ozlabs.ru>
Il 16/03/2013 08:16, Alexey Kardashevskiy ha scritto:
> SCSI protocol is defined as big endian. The SCSI command REPORT_LUNS
> returns the list of LUNs, 8 bytes each.
>
> The store_lun() function is called from scsi_target_emulate_report_luns()
> to fill the LUNs list which is sent later to a guest a response. However
> it puts the 2 bytes long big-endian value while it is 8 bytes long.
No, LUNs are composed of four 2-byte big-endian values.
What bug are you trying to fix?
Paolo
> The patch fixes it. Tested on PPC64 platform.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> hw/scsi-bus.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> index a97f1cd..7059dc2 100644
> --- a/hw/scsi-bus.c
> +++ b/hw/scsi-bus.c
> @@ -310,11 +310,11 @@ struct SCSITargetReq {
> static void store_lun(uint8_t *outbuf, int lun)
> {
> if (lun < 256) {
> - outbuf[1] = lun;
> + outbuf[7] = lun;
> return;
> }
> - outbuf[1] = (lun & 255);
> - outbuf[0] = (lun >> 8) | 0x40;
> + outbuf[7] = (lun & 255);
> + outbuf[6] = (lun >> 8) | 0x40;
> }
>
> static bool scsi_target_emulate_report_luns(SCSITargetReq *r)
>
next prev parent reply other threads:[~2013-03-16 8:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-16 7:16 [Qemu-devel] [PATCH] scsi-bus: fix endianness bug in store_lun() Alexey Kardashevskiy
2013-03-16 8:13 ` Paolo Bonzini [this message]
2013-03-16 12:11 ` Alexey Kardashevskiy
2013-03-16 13:01 ` Benjamin Herrenschmidt
2013-03-16 13:09 ` Paolo Bonzini
2013-03-17 1:32 ` Benjamin Herrenschmidt
2013-03-16 14:10 ` Alexey Kardashevskiy
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=514429B2.4010207@redhat.com \
--to=pbonzini@redhat.com \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).