aboutsummaryrefslogtreecommitdiff
path: root/kernel/mm/physical_mm/physical_mm.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-01-08 13:30:03 -0500
committerRaghuram Subramani <raghus2247@gmail.com>2025-01-08 13:30:03 -0500
commit0f68b58faab284b60cfc761b4cc3655a208be350 (patch)
treefdacacff1aced769d3edbbf96bec1fe3c2ecd0c1 /kernel/mm/physical_mm/physical_mm.c
parent843c0f75b92d2471315f160d2ad62284bec11378 (diff)
kernel: mm: physical: Fix bug with inverted test_bit() return value
Diffstat (limited to 'kernel/mm/physical_mm/physical_mm.c')
-rw-r--r--kernel/mm/physical_mm/physical_mm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/mm/physical_mm/physical_mm.c b/kernel/mm/physical_mm/physical_mm.c
index f971623..a368680 100644
--- a/kernel/mm/physical_mm/physical_mm.c
+++ b/kernel/mm/physical_mm/physical_mm.c
@@ -115,8 +115,8 @@ physical_mm_init(void)
}
/* Returns:
- * True if the bit is unset (block isn't in use)
- * False if the bit is set (block is in use)
+ * True if the bit is set (block is in use)
+ * False if the bit is unset (block isn't in use)
*/
ALWAYS_INLINE static bool
physical_mm_test_bit(const uint32_t bit)
@@ -134,7 +134,7 @@ physical_mm_find_first_free_block(void)
if (memory_map[i] != 0xffffffff)
/* Test each bit to see if it's zero */
for (uint32_t j = 0; j < BITMAP_ENTRY_SIZE; j++)
- if (physical_mm_test_bit(i * BITMAP_ENTRY_SIZE + j))
+ if (!physical_mm_test_bit(i * BITMAP_ENTRY_SIZE + j))
return i * BITMAP_ENTRY_SIZE + j;
/* Shouldn't be reached, since we're keeping track of the number of free