IORequest::Init(): Assert offset >= 0

Just to make sure we catch sparse file vectors that shouldn't be passed
here.
This commit is contained in:
Ingo Weinhold 2013-11-11 22:17:34 +01:00
parent c63b3de665
commit 9f7e78ee79

View File

@ -724,6 +724,8 @@ status_t
IORequest::Init(off_t offset, generic_addr_t buffer, generic_size_t length,
bool write, uint32 flags)
{
ASSERT(offset >= 0);
generic_io_vec vec;
vec.base = buffer;
vec.length = length;
@ -736,6 +738,8 @@ IORequest::Init(off_t offset, generic_size_t firstVecOffset,
const generic_io_vec* vecs, size_t count, generic_size_t length, bool write,
uint32 flags)
{
ASSERT(offset >= 0);
fBuffer = IOBuffer::Create(count, (flags & B_VIP_IO_REQUEST) != 0);
if (fBuffer == NULL)
return B_NO_MEMORY;