mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03: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
Notes:
sideshowbarker
2024-07-17 03:30:41 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/c8bdcd90a8 Pull-request: https://github.com/SerenityOS/serenity/pull/19714 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/Panky-codes
@ -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…
Reference in New Issue
Block a user