mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +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:
parent
763ef690c6
commit
c8bdcd90a8
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue