lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251129134834.34559-1-atharvd440@gmail.com>
Date: Sat, 29 Nov 2025 19:18:34 +0530
From: Atharv Dubey <atharvd440@...il.com>
To: airlied@...il.com,
	simona@...ll.ch,
	dakr@...nel.org,
	aliceryhl@...gle.com,
	ojeda@...nel.org,
	alex.gaynor@...il.com
Cc: boqun.feng@...il.com,
	gary@...yguo.net,
	bjorn3_gh@...tonmail.com,
	lossin@...nel.org,
	a.hindborg@...nel.org,
	tmgross@...ch.edu,
	daniel.almeida@...labora.com,
	lyude@...hat.com,
	shankari.ak0208@...il.com,
	lina+kernel@...hilina.net,
	dri-devel@...ts.freedesktop.org,
	rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Atharv Dubey <atharvd440@...il.com>
Subject: [PATCH] rust: drm: use `pin_init::zeroed()` for file operations initialization

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@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ