qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b
@ 2014-01-29 17:47 Markus Armbruster
  2014-01-29 17:51 ` Paolo Bonzini
  2014-02-24 13:07 ` Markus Armbruster
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2014-01-29 17:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

The transfer length depends on field BYTCHK, which is encoded in byte
1, bits 1..2.  However, the guard for for case BYTCHK=11b doesn't
work, and we get case 01b instead.  Fix it.

Note that since emulated scsi-hd fails the command outright, it takes
SCSI passthrough of a device that actually implements VERIFY with
BYTCHK=11b to make the bug bite.

Screwed up in commit d12ad44.  Spotted by Coverity.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/scsi/scsi-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 50b89ad..285a58b 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -909,7 +909,7 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
     case VERIFY_16:
         if ((buf[1] & 2) == 0) {
             cmd->xfer = 0;
-        } else if ((buf[1] & 4) == 1) {
+        } else if ((buf[1] & 4) != 0) {
             cmd->xfer = 1;
         }
         cmd->xfer *= dev->blocksize;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b
  2014-01-29 17:47 [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b Markus Armbruster
@ 2014-01-29 17:51 ` Paolo Bonzini
  2014-02-24 13:07 ` Markus Armbruster
  1 sibling, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-01-29 17:51 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel

Il 29/01/2014 18:47, Markus Armbruster ha scritto:
> The transfer length depends on field BYTCHK, which is encoded in byte
> 1, bits 1..2.  However, the guard for for case BYTCHK=11b doesn't
> work, and we get case 01b instead.  Fix it.
>
> Note that since emulated scsi-hd fails the command outright, it takes
> SCSI passthrough of a device that actually implements VERIFY with
> BYTCHK=11b to make the bug bite.
>
> Screwed up in commit d12ad44.  Spotted by Coverity.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 50b89ad..285a58b 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -909,7 +909,7 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
>      case VERIFY_16:
>          if ((buf[1] & 2) == 0) {
>              cmd->xfer = 0;
> -        } else if ((buf[1] & 4) == 1) {
> +        } else if ((buf[1] & 4) != 0) {
>              cmd->xfer = 1;
>          }
>          cmd->xfer *= dev->blocksize;
>

Applied to scsi-next, thanks.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b
  2014-01-29 17:47 [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b Markus Armbruster
  2014-01-29 17:51 ` Paolo Bonzini
@ 2014-02-24 13:07 ` Markus Armbruster
  2014-02-24 13:25   ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2014-02-24 13:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

Ping?

Markus Armbruster <armbru@redhat.com> writes:

> The transfer length depends on field BYTCHK, which is encoded in byte
> 1, bits 1..2.  However, the guard for for case BYTCHK=11b doesn't
> work, and we get case 01b instead.  Fix it.
>
> Note that since emulated scsi-hd fails the command outright, it takes
> SCSI passthrough of a device that actually implements VERIFY with
> BYTCHK=11b to make the bug bite.
>
> Screwed up in commit d12ad44.  Spotted by Coverity.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 50b89ad..285a58b 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -909,7 +909,7 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
>      case VERIFY_16:
>          if ((buf[1] & 2) == 0) {
>              cmd->xfer = 0;
> -        } else if ((buf[1] & 4) == 1) {
> +        } else if ((buf[1] & 4) != 0) {
>              cmd->xfer = 1;
>          }
>          cmd->xfer *= dev->blocksize;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b
  2014-02-24 13:07 ` Markus Armbruster
@ 2014-02-24 13:25   ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-02-24 13:25 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel

Il 24/02/2014 14:07, Markus Armbruster ha scritto:
> Ping?

The pull request depends on Kevin's block patches, so I need to wait for 
that one to get in.

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-24 13:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 17:47 [Qemu-devel] [PATCH] scsi-bus: Fix transfer length for VERIFY with BYTCHK=11b Markus Armbruster
2014-01-29 17:51 ` Paolo Bonzini
2014-02-24 13:07 ` Markus Armbruster
2014-02-24 13:25   ` Paolo Bonzini

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).