rust/kernel/drm/gem/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Replace the manual `unsafe { core::mem::zeroed() }` initialization of
`bindings::file_operations` with `pin_init::zeroed()`. This removes the
explicit unsafe
Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
---
rust/kernel/drm/gem/mod.rs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
index 30c853988b94..c220cf1966fd 100644
--- a/rust/kernel/drm/gem/mod.rs
+++ b/rust/kernel/drm/gem/mod.rs
@@ -298,9 +298,8 @@ impl<T: DriverObject> AllocImpl for Object<T> {
}
pub(super) const fn create_fops() -> bindings::file_operations {
- // SAFETY: As by the type invariant, it is safe to initialize `bindings::file_operations`
- // zeroed.
- let mut fops: bindings::file_operations = unsafe { core::mem::zeroed() };
+
+ let mut fops: bindings::file_operations = pin_init::zeroed();
fops.owner = core::ptr::null_mut();
fops.open = Some(bindings::drm_open);
--
2.43.0
On Sat, Nov 29, 2025 at 2:48 PM Atharv Dubey <atharvd440@gmail.com> wrote: > > + Spurious newline? Cheers, Miguel
On Sat, Nov 29, 2025 at 03:30:53PM +0100, Miguel Ojeda wrote: > On Sat, Nov 29, 2025 at 2:48 PM Atharv Dubey <atharvd440@gmail.com> wrote: > > > > + > > Spurious newline? > > Sorry for this, I will send a V2 of the patch. > Cheers, > Miguel
© 2016 - 2025 Red Hat, Inc.