diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index d3c87ac6..f1c76857 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -5,6 +5,7 @@ #include "memory/KernelVM.h" #include "memory/MemoryManager.h" #include +#include #include #include @@ -332,8 +333,7 @@ Result krealloc(void* ptr, usize size) Result kcalloc(usize nmemb, usize size) { - // FIXME: Check for overflows. - const usize realsize = nmemb * size; + const usize realsize = TRY(safe_mul(nmemb, size)); void* const ptr = TRY(kmalloc(realsize)); return memset(ptr, 0, realsize); }