Fix #4125: NULL device is translated to '//'

The problem appeared to be on the request creating side (i.e. in the
kernel add-on) which did not support NULL pointers properly.

Relocation of addresses in request when it is received translates
offset = 0, size = 0 to pointer NULL so that no change in that part
of code was required.

Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>
This commit is contained in:
Pawel Dziepak 2012-04-07 15:04:45 +02:00 committed by Ingo Weinhold
parent 7c369a4b3f
commit 96944cbb3c
1 changed files with 11 additions and 7 deletions

View File

@ -264,13 +264,17 @@ status_t
RequestAllocator::AllocateData(Address& address, const void* data, int32 size, RequestAllocator::AllocateData(Address& address, const void* data, int32 size,
int32 align, bool deferredInit) int32 align, bool deferredInit)
{ {
void* destination; status_t error = B_OK;
status_t error = AllocateAddress(address, size, align, &destination, if (data != NULL) {
deferredInit); void* destination;
if (error != B_OK) error = AllocateAddress(address, size, align, &destination,
return error; deferredInit);
if (size > 0) if (error != B_OK)
memcpy(destination, data, size); return error;
if (size > 0)
memcpy(destination, data, size);
} else
address.SetTo(-1, 0, 0);
return error; return error;
} }