mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-30 00:13:21 +00:00
Kernel/Storage: Fix StorageDevice STORAGE_DEVICE_GET_SIZE ioctl option
It calculated the disk size with the zero-based max addressable block value. For example, for a disk device with a block size of 512 bytes that has 2 LBAs so it can address LBA 0 and LBA 1 (so m_max_addressable_block is 1) the calculated disk size will be 512 instead of 1024 bytes.
This commit is contained in:
@@ -246,7 +246,7 @@ ErrorOr<void> StorageDevice::ioctl(OpenFileDescription&, unsigned request, Users
|
||||
{
|
||||
switch (request) {
|
||||
case STORAGE_DEVICE_GET_SIZE: {
|
||||
u64 disk_size = m_max_addressable_block * block_size();
|
||||
u64 disk_size = max_mathematical_addressable_block() * block_size();
|
||||
return copy_to_user(static_ptr_cast<u64*>(arg), &disk_size);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user