Skip to content

Commit

Permalink
[libata] Fix decoding of 6-byte commands
Browse files Browse the repository at this point in the history
The code for parsing 6-byte SCSI command LBAs
missed the top 5 bits (the MSB).

Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Jeff Garzik committed May 25, 2007
1 parent ddfc87a commit 6c7b7d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,14 +1050,15 @@ static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
u64 lba = 0;
u32 len = 0;
u32 len;

VPRINTK("six-byte command\n");

lba |= ((u64)(cdb[1] & 0x1f)) << 16;
lba |= ((u64)cdb[2]) << 8;
lba |= ((u64)cdb[3]);

len |= ((u32)cdb[4]);
len = cdb[4];

*plba = lba;
*plen = len;
Expand Down

0 comments on commit 6c7b7d2

Please sign in to comment.