diff --git a/src/system/kernel/messaging/MessagingService.cpp b/src/system/kernel/messaging/MessagingService.cpp index fe83fd3da0..e20b29e7d2 100644 --- a/src/system/kernel/messaging/MessagingService.cpp +++ b/src/system/kernel/messaging/MessagingService.cpp @@ -200,7 +200,8 @@ MessagingArea::AllocateCommand(uint32 commandWhat, int32 dataSize, } // init the command - BytePointer command((char*)fHeader + commandOffset); + BytePointer command(fHeader); + command += commandOffset; command->next_command = 0; command->command = commandWhat; command->size = size; @@ -243,7 +244,8 @@ MessagingArea::_CheckCommand(int32 offset, int32 &size) } // get and check size - BytePointer command((char*)fHeader + offset); + BytePointer command(fHeader); + command += offset; size = command->size; if (size < (int32)sizeof(messaging_command)) return NULL; diff --git a/src/system/kernel/slab/SmallObjectCache.cpp b/src/system/kernel/slab/SmallObjectCache.cpp index 8e6df40f8f..73c82cf9c4 100644 --- a/src/system/kernel/slab/SmallObjectCache.cpp +++ b/src/system/kernel/slab/SmallObjectCache.cpp @@ -17,9 +17,10 @@ RANGE_MARKER_FUNCTION_BEGIN(SlabSmallObjectCache) static inline slab * -slab_in_pages(const void *pages, size_t slab_size) +slab_in_pages(void *pages, size_t slab_size) { - BytePointer pointer(((uint8 *)pages) + slab_size - sizeof(slab)); + BytePointer pointer(pages); + pointer += slab_size - sizeof(slab); return &pointer; }