Fix subtle but important error in transfer length calculation. That calculation

does calculate the remaining bytes, not the transferred ones, so obviously that
number has to be subtracted from the expected buffer size! Albeit severe, this
wasn't hit that often, because this calculation will only be used when the
transferred size doesn't match the handed in buffer size exactly. So things like
HID or mass storage, that mostly know the exact transfer size weren't affected.
But it could very well explain #4101 where the size isn't previously know.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32680 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2009-08-26 00:06:15 +00:00
parent b02c147c05
commit 12f584636c
1 changed files with 2 additions and 2 deletions

View File

@ -1664,7 +1664,7 @@ OHCI::_ReadDescriptorChain(ohci_general_td *topDescriptor, iovec *vector,
size_t bufferSize = current->buffer_size;
if (current->buffer_physical != 0) {
bufferSize = current->last_physical_byte_address
bufferSize -= current->last_physical_byte_address
- current->buffer_physical + 1;
}
@ -1716,7 +1716,7 @@ OHCI::_ReadActualLength(ohci_general_td *topDescriptor)
!= OHCI_TD_CONDITION_NOT_ACCESSED) {
size_t length = current->buffer_size;
if (current->buffer_physical != 0) {
length = current->last_physical_byte_address
length -= current->last_physical_byte_address
- current->buffer_physical + 1;
}