summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-26 18:10:35 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-26 21:22:59 +0100
commitc6c786c992de0add4fcb27f9d163fe6c3b1becad (patch)
treee493cd7d23de8b3f5940db2d83480585263eb30d /Kernel
parent6eb48f7df642fc02ff766eddd31f15c6a2cfeb14 (diff)
downloadserenity-c6c786c992de0add4fcb27f9d163fe6c3b1becad.zip
Kernel: Remove kfree(), leaving only kfree_sized() :^)
There are no more users of the C-style kfree() API in the kernel, so let's get rid of it and enjoy the new world where we always know how much memory we are freeing. :^)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Heap/kmalloc.cpp8
-rw-r--r--Kernel/Heap/kmalloc.h1
2 files changed, 2 insertions, 7 deletions
diff --git a/Kernel/Heap/kmalloc.cpp b/Kernel/Heap/kmalloc.cpp
index 9171004a47..8d992d86bf 100644
--- a/Kernel/Heap/kmalloc.cpp
+++ b/Kernel/Heap/kmalloc.cpp
@@ -274,15 +274,11 @@ void* kmalloc(size_t size)
void kfree_sized(void* ptr, size_t size)
{
- (void)size;
- return kfree(ptr);
-}
-
-void kfree(void* ptr)
-{
if (!ptr)
return;
+ VERIFY(size > 0);
+
kmalloc_verify_nospinlock_held();
SpinlockLocker lock(s_lock);
++g_kfree_call_count;
diff --git a/Kernel/Heap/kmalloc.h b/Kernel/Heap/kmalloc.h
index 5ebfe91807..c91bb28446 100644
--- a/Kernel/Heap/kmalloc.h
+++ b/Kernel/Heap/kmalloc.h
@@ -41,7 +41,6 @@ enum class align_val_t : size_t {};
void kmalloc_init();
[[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] void* kmalloc_eternal(size_t);
-void kfree(void*);
void kfree_sized(void*, size_t);
struct kmalloc_stats {