From b946a2b15f870b9f46d2b19aa1c5b87eaceed3fd Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 28 Aug 2024 15:19:16 +0200 Subject: [PATCH] Added error handling for illegal NUMA nodes in memory allocator. --- src/mx/memory/global_heap.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mx/memory/global_heap.h b/src/mx/memory/global_heap.h index 9a0cc93..0b4d5a1 100644 --- a/src/mx/memory/global_heap.h +++ b/src/mx/memory/global_heap.h @@ -38,6 +38,8 @@ public: inline void *local_allocate(const std::uint8_t numa_node_id, const std::size_t size) { + if (heaps[numa_node_id] == nullptr) + Genode::error("No local heap for NUMA node ", numa_node_id); return heaps[numa_node_id]->alloc(size); } @@ -95,6 +97,8 @@ public: { void *ptr = nullptr; posix_memalign(&ptr, 64, alignment_helper::next_multiple(size, 64UL)); + if (!ptr) + Genode::error("posix_memalign returned NULL"); return ptr; }