From ccc5280e22e74920d69260f1ab80ddf231068e01 Mon Sep 17 00:00:00 2001
From: Lyude Paul <lyude@redhat.com>
Date: Thu, 12 Dec 2024 16:34:04 -0500
Subject: [PATCH] squash! WIP: rust: drm/kms: Add drm_crtc bindings

* Add missing safety comment in Crtc::new()
---
 rust/kernel/drm/kms/crtc.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/rust/kernel/drm/kms/crtc.rs b/rust/kernel/drm/kms/crtc.rs
index f703b7fd8c6f3..a2e58bb41f465 100644
--- a/rust/kernel/drm/kms/crtc.rs
+++ b/rust/kernel/drm/kms/crtc.rs
@@ -309,6 +309,10 @@ impl<T: DriverCrtc> Crtc<T> {
             GFP_KERNEL
         )?;
 
+        // SAFETY:
+        // - We just allocated `this`, and we won't move it since it's pinned
+        // - `primary` and `cursor` share the lifetime 'a with `dev`
+        // - This function will memcpy the contents of `name` into its own storage.
         to_result(unsafe {
             bindings::drm_crtc_init_with_planes(
                 dev.as_raw(),
-- 
GitLab