diff options
| author | hathach <[email protected]> | 2021-09-30 20:14:23 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-09-30 20:14:23 +0700 |
| commit | 7708997a679f61b2ea8fdc7bec880cd19ecaa28f (patch) | |
| tree | 72fa7bab64f4deaf9e6d700a6b447f8b090996d9 /src/class | |
| parent | 14514d7087b971c8e3b000d290cad104e7d7083b (diff) | |
change scsis status to phase error when total_bytes < block_count
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/msc/msc_device.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index b65abe979..87ebe227f 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -182,15 +182,15 @@ uint8_t rdwr10_validate_cmd(msc_cbw_t const* cbw) TU_LOG(MSC_DEBUG, " SCSI case 8 (Hi <> Do)\r\n"); status = MSC_CSW_STATUS_PHASE_ERROR; } - else if ( !block_count ) + else if ( 0 == block_count ) { - TU_LOG(MSC_DEBUG, " SCSI case 4 Hi > Dn\r\n"); + TU_LOG(MSC_DEBUG, " SCSI case 4 Hi > Dn (READ10) or case 9 Ho > Dn (WRITE10) \r\n"); status = MSC_CSW_STATUS_FAILED; } - else if ( SCSI_CMD_READ_10 == cbw->command[0] && cbw->total_bytes / block_count == 0) + else if ( cbw->total_bytes / block_count == 0 ) { - TU_LOG(MSC_DEBUG, " Computed block size 0\r\n"); - status = MSC_CSW_STATUS_FAILED; + TU_LOG(MSC_DEBUG, " Computed block size = 0. SCSI case 7 Hi < Di (READ10) or case 13 Ho < Do (WRIT10)\r\n"); + status = MSC_CSW_STATUS_PHASE_ERROR; } } |
