summaryrefslogtreecommitdiff
path: root/rust/kernel/drm/ioctl.rs
diff options
context:
space:
mode:
authorRodrigo Vivi <rodrigo.vivi@intel.com>2025-09-10 08:01:42 -0400
committerRodrigo Vivi <rodrigo.vivi@intel.com>2025-09-10 08:01:42 -0400
commit702fdf3513b045f596f836d9a4b8672c76f11834 (patch)
tree4034b3baf8db7119ab738ac5bd6fcbeb890fea94 /rust/kernel/drm/ioctl.rs
parentb69f8c496ea05f80c2bae91a74b48c00c06c524e (diff)
parent4bf83dd6e3b3b2a131e357f035b17edaee6f6766 (diff)
Merge drm/drm-next into drm-intel-next
Catching up with some display dependencies. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'rust/kernel/drm/ioctl.rs')
-rw-r--r--rust/kernel/drm/ioctl.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/rust/kernel/drm/ioctl.rs b/rust/kernel/drm/ioctl.rs
index 445639404fb7..af1bb29cf06d 100644
--- a/rust/kernel/drm/ioctl.rs
+++ b/rust/kernel/drm/ioctl.rs
@@ -83,7 +83,7 @@ pub mod internal {
///
/// ```ignore
/// fn foo(device: &kernel::drm::Device<Self>,
-/// data: &Opaque<uapi::argument_type>,
+/// data: &mut uapi::argument_type,
/// file: &kernel::drm::File<Self::File>,
/// ) -> Result<u32>
/// ```
@@ -134,15 +134,18 @@ macro_rules! declare_drm_ioctls {
// FIXME: Currently there is nothing enforcing that the types of the
// dev/file match the current driver these ioctls are being declared
// for, and it's not clear how to enforce this within the type system.
- let dev = $crate::drm::device::Device::as_ref(raw_dev);
+ let dev = $crate::drm::device::Device::from_raw(raw_dev);
// SAFETY: The ioctl argument has size `_IOC_SIZE(cmd)`, which we
// asserted above matches the size of this type, and all bit patterns of
// UAPI structs must be valid.
- let data = unsafe {
- &*(raw_data as *const $crate::types::Opaque<$crate::uapi::$struct>)
- };
+ // The `ioctl` argument is exclusively owned by the handler
+ // and guaranteed by the C implementation (`drm_ioctl()`) to remain
+ // valid for the entire lifetime of the reference taken here.
+ // There is no concurrent access or aliasing; no other references
+ // to this object exist during this call.
+ let data = unsafe { &mut *(raw_data.cast::<$crate::uapi::$struct>()) };
// SAFETY: This is just the DRM file structure
- let file = unsafe { $crate::drm::File::as_ref(raw_file) };
+ let file = unsafe { $crate::drm::File::from_raw(raw_file) };
match $func(dev, data, file) {
Err(e) => e.to_errno(),