From 96944cbb3c2efbfa54c3c279c64758389ded0fdc Mon Sep 17 00:00:00 2001 From: Pawel Dziepak Date: Sat, 7 Apr 2012 15:04:45 +0200 Subject: [PATCH] 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 --- .../userlandfs/private/RequestAllocator.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/add-ons/kernel/file_systems/userlandfs/private/RequestAllocator.cpp b/src/add-ons/kernel/file_systems/userlandfs/private/RequestAllocator.cpp index 0316b56bd9..8f33dbba3f 100644 --- a/src/add-ons/kernel/file_systems/userlandfs/private/RequestAllocator.cpp +++ b/src/add-ons/kernel/file_systems/userlandfs/private/RequestAllocator.cpp @@ -264,13 +264,17 @@ status_t RequestAllocator::AllocateData(Address& address, const void* data, int32 size, int32 align, bool deferredInit) { - void* destination; - status_t error = AllocateAddress(address, size, align, &destination, - deferredInit); - if (error != B_OK) - return error; - if (size > 0) - memcpy(destination, data, size); + status_t error = B_OK; + if (data != NULL) { + void* destination; + error = AllocateAddress(address, size, align, &destination, + deferredInit); + if (error != B_OK) + return error; + if (size > 0) + memcpy(destination, data, size); + } else + address.SetTo(-1, 0, 0); return error; }