diff --git a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp index 5ef971b325..7ec36484af 100644 --- a/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp +++ b/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "BeOSCompatibility.h" #include "PhysicalMemoryAllocator.h" @@ -133,6 +134,13 @@ PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress, { #ifdef HAIKU_TARGET_PLATFORM_HAIKU if (debug_debugger_running()) { + if (size > fDebugChunkSize) { + kprintf("usb allocation of %" B_PRIuSIZE + " does not fit debug chunk size %" B_PRIuSIZE "!\n", + size, fDebugChunkSize); + return B_NO_MEMORY; + } + for (int32 i = 0; i < 64; i++) { uint64 mask = 1LL << i; if ((fDebugUseMap & mask) == 0) {