From 51db1706e9bd607d7f61c8e18a746104893dd8fc Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 22 Feb 2024 13:31:12 +0200 Subject: [PATCH] Kernel: Fix checking of partition boundaries on write --- kernel/kernel/Storage/Partition.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kernel/Storage/Partition.cpp b/kernel/kernel/Storage/Partition.cpp index caf21595..119b2549 100644 --- a/kernel/kernel/Storage/Partition.cpp +++ b/kernel/kernel/Storage/Partition.cpp @@ -41,7 +41,7 @@ namespace Kernel { ASSERT(buffer.size() >= block_count * m_device->blksize()); const uint32_t blocks_in_partition = m_last_block - m_first_block + 1; - if (m_first_block + block_count > blocks_in_partition) + if (first_block + block_count > blocks_in_partition) return BAN::Error::from_error_code(ErrorCode::Storage_Boundaries); TRY(m_device->write_blocks(m_first_block + first_block, block_count, buffer)); return {};