Skip to content

Commit

Permalink
Update handling of allocation length for SCSI-1-CCS
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Oct 26, 2024
1 parent cd56e1c commit 717e405
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cpp/base/primary_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ void PrimaryDevice::RequestSense()

const vector<byte> &buf = GetController()->GetDeviceForLun(effective_lun)->HandleRequestSense();

const auto length = static_cast<int>(min(buf.size(), static_cast<size_t>(GetController()->GetCdbByte(4))));
int allocation_length = GetController()->GetCdbByte(4);
if (!allocation_length && level == scsi_level::scsi_1_ccs) {
allocation_length = 4;
}
const auto length = static_cast<int>(min(buf.size(), static_cast<size_t>(allocation_length)));
GetController()->CopyToBuffer(buf.data(), length);

// Clear the previous status
Expand Down

0 comments on commit 717e405

Please sign in to comment.