diff options
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index c1cf5e038967..3ba1fefb8374 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1482,8 +1482,12 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | |||
1482 | n_sectors = ata_id_u32(args->id, 60); | 1482 | n_sectors = ata_id_u32(args->id, 60); |
1483 | n_sectors--; /* ATA TotalUserSectors - 1 */ | 1483 | n_sectors--; /* ATA TotalUserSectors - 1 */ |
1484 | 1484 | ||
1485 | tmp = n_sectors; /* note: truncates, if lba48 */ | ||
1486 | if (args->cmd->cmnd[0] == READ_CAPACITY) { | 1485 | if (args->cmd->cmnd[0] == READ_CAPACITY) { |
1486 | if( n_sectors >= 0xffffffffULL ) | ||
1487 | tmp = 0xffffffff ; /* Return max count on overflow */ | ||
1488 | else | ||
1489 | tmp = n_sectors ; | ||
1490 | |||
1487 | /* sector count, 32-bit */ | 1491 | /* sector count, 32-bit */ |
1488 | rbuf[0] = tmp >> (8 * 3); | 1492 | rbuf[0] = tmp >> (8 * 3); |
1489 | rbuf[1] = tmp >> (8 * 2); | 1493 | rbuf[1] = tmp >> (8 * 2); |
@@ -1497,10 +1501,12 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | |||
1497 | 1501 | ||
1498 | } else { | 1502 | } else { |
1499 | /* sector count, 64-bit */ | 1503 | /* sector count, 64-bit */ |
1500 | rbuf[2] = n_sectors >> (8 * 7); | 1504 | tmp = n_sectors >> (8 * 4); |
1501 | rbuf[3] = n_sectors >> (8 * 6); | 1505 | rbuf[2] = tmp >> (8 * 3); |
1502 | rbuf[4] = n_sectors >> (8 * 5); | 1506 | rbuf[3] = tmp >> (8 * 2); |
1503 | rbuf[5] = n_sectors >> (8 * 4); | 1507 | rbuf[4] = tmp >> (8 * 1); |
1508 | rbuf[5] = tmp; | ||
1509 | tmp = n_sectors; | ||
1504 | rbuf[6] = tmp >> (8 * 3); | 1510 | rbuf[6] = tmp >> (8 * 3); |
1505 | rbuf[7] = tmp >> (8 * 2); | 1511 | rbuf[7] = tmp >> (8 * 2); |
1506 | rbuf[8] = tmp >> (8 * 1); | 1512 | rbuf[8] = tmp >> (8 * 1); |