1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

Kernel: Use static_ptr_cast to convert between Userspace<T*> types

Some calls of copy_to_user were converting Userspace<T*> to
Userspace<U*> via the implicit conversion to FlatPtr. Change them to use
the static_ptr_cast overload that is designed to express this conversion
This commit is contained in:
Andrew Kaster 2021-11-14 15:43:43 -07:00 committed by Andreas Kling
parent 194456efdc
commit 7243bcb7da
4 changed files with 5 additions and 5 deletions

View file

@ -193,12 +193,12 @@ ErrorOr<void> StorageDevice::ioctl(OpenFileDescription&, unsigned request, Users
switch (request) {
case STORAGE_DEVICE_GET_SIZE: {
size_t disk_size = m_max_addressable_block * block_size();
return copy_to_user(Userspace<size_t*>(arg), &disk_size);
return copy_to_user(static_ptr_cast<size_t*>(arg), &disk_size);
break;
}
case STORAGE_DEVICE_GET_BLOCK_SIZE: {
size_t size = block_size();
return copy_to_user(Userspace<size_t*>(arg), &size);
return copy_to_user(static_ptr_cast<size_t*>(arg), &size);
break;
}
default: