#429 Bad 6- to 10-byte CDB conversion in ahci_scsi.c

closed-fixed
5
2013-02-18
2012-12-09
Mark K
No

The 6- to 10-byte CDB conversion for READ (6) and WRITE (6) commands in ahci_scsi.c doesn't handle the case where the transfer length field is zero. In that case the actual length transferred is 256 sectors. Here are two suggested changes. Perhaps the first change is better/more understandable.

First change:
offset = (cdbd->rw_6.addr[0] << 16) |
(cdbd->rw_6.addr[1] << 8) |
(cdbd->rw_6.addr[2]);
len = cdbd->rw_6.length;
if (len == 0) len = 256; // this line added

An alternative would be to change a different line a little later in the file:
cdbd->rw_10.length[0] = (len == 0) ? 1 : 0; // this line changed
cdbd->rw_10.length[1] = (len >> 0) & 0xff; // [That could just be replaced with len]
break;

Discussion

    • status: open --> open-fixed
     
  • Fixed by SVN revision r46593 (ABIv1) and backported to ABIv0

     
    • assigned_to: nobody --> ezrec
    • status: open-fixed --> closed-fixed