From 6d3a7fabeb2a20786017d8fefc7a3b26de1ae25e Mon Sep 17 00:00:00 2001 From: Pankaj Raghav Date: Sat, 26 Mar 2022 18:49:07 +0100 Subject: [PATCH] Kernel: Remove hardcoded values for block size in Ramdisk Instead of using the hardcoded 512 in Ramdisk, retrieve the block size value from the AsyncBlockDeviceRequest struct. --- Kernel/Storage/Ramdisk/Device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Storage/Ramdisk/Device.cpp b/Kernel/Storage/Ramdisk/Device.cpp index 4beb3a3083..9062926819 100644 --- a/Kernel/Storage/Ramdisk/Device.cpp +++ b/Kernel/Storage/Ramdisk/Device.cpp @@ -45,8 +45,8 @@ void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request) u8* base = m_region->vaddr().as_ptr(); size_t size = m_region->size(); - u8* offset = base + request.block_index() * 512; - size_t length = request.block_count() * 512; + u8* offset = base + request.block_index() * request.block_size(); + size_t length = request.buffer_size(); if ((offset + length > base + size) || (offset + length < base)) { request.complete(AsyncDeviceRequest::Failure);