diff options
Diffstat (limited to 'rust/kernel/drm/ioctl.rs')
| -rw-r--r-- | rust/kernel/drm/ioctl.rs | 13 | 
1 files changed, 8 insertions, 5 deletions
diff --git a/rust/kernel/drm/ioctl.rs b/rust/kernel/drm/ioctl.rs index fdec01c37168..69efbdb4c85a 100644 --- a/rust/kernel/drm/ioctl.rs +++ b/rust/kernel/drm/ioctl.rs @@ -2,7 +2,7 @@  //! DRM IOCTL definitions.  //! -//! C header: [`include/linux/drm/drm_ioctl.h`](srctree/include/linux/drm/drm_ioctl.h) +//! C header: [`include/drm/drm_ioctl.h`](srctree/include/drm/drm_ioctl.h)  use crate::ioctl; @@ -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>  /// ``` @@ -138,9 +138,12 @@ macro_rules! declare_drm_ioctls {                              // 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::from_raw(raw_file) };  | 
