X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/1c79356b52d46aa6b508fb032f5ae709b1f2897b..e3027f41d0120b4278cca462f397b6619dcd9ac5:/iokit/Families/IOStorage/IOBlockStorageDriver.cpp?ds=sidebyside diff --git a/iokit/Families/IOStorage/IOBlockStorageDriver.cpp b/iokit/Families/IOStorage/IOBlockStorageDriver.cpp index 8e843b49a..345e55b56 100644 --- a/iokit/Families/IOStorage/IOBlockStorageDriver.cpp +++ b/iokit/Families/IOStorage/IOBlockStorageDriver.cpp @@ -1759,7 +1759,7 @@ IOByteCount IODeblocker::readBytes( IOByteCount offset, for ( ; index < _chunksCount && withLength; index++) { - IOByteCount copy = min(_chunks[index].length, withLength); + IOByteCount copy = min(_chunks[index].length - offset, withLength); IOByteCount copied = _chunks[index].buffer->readBytes( /* offset */ offset + _chunks[index].offset, /* bytes */ bytes, @@ -1798,7 +1798,7 @@ IOByteCount IODeblocker::writeBytes( IOByteCount offset, for ( ; index < _chunksCount && withLength; index++) { - IOByteCount copy = min(_chunks[index].length, withLength); + IOByteCount copy = min(_chunks[index].length - offset, withLength); IOByteCount copied = _chunks[index].buffer->writeBytes( /* offset */ offset + _chunks[index].offset, /* bytes */ bytes,