On Fri, Mar 14, 2025 at 11:41:55PM +0000, Antonio Hickey wrote: [...] > /// Recreates an [`Arc`] instance previously deconstructed via [`Arc::into_raw`]. > diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs > index 49012e711942..b2ac768eed23 100644 > --- a/rust/kernel/task.rs > +++ b/rust/kernel/task.rs > @@ -257,7 +257,7 @@ pub fn as_ptr(&self) -> *mut bindings::task_struct { > pub fn group_leader(&self) -> &Task { > // SAFETY: The group leader of a task never changes after initialization, so reading this > // field is not a data race. > - let ptr = unsafe { *ptr::addr_of!((*self.as_ptr()).group_leader) }; > + let ptr = unsafe { *(&raw const (*self.as_ptr()).group_leader) }; This can be a let ptr = unsafe { (*self.as_ptr()).group_leader }; > > // SAFETY: The lifetime of the returned task reference is tied to the lifetime of `self`, > // and given that a task has a reference to its group leader, we know it must be valid for > @@ -269,7 +269,7 @@ pub fn group_leader(&self) -> &Task { > pub fn pid(&self) -> Pid { > // SAFETY: The pid of a task never changes after initialization, so reading this field is > // not a data race. > - unsafe { *ptr::addr_of!((*self.as_ptr()).pid) } > + unsafe { *(&raw const (*self.as_ptr()).pid) } ditto: unsafe { (*self.as_ptr()).pid } because `*self.as_ptr()` is a place expression and won't create temporary references. There are also a few clippy warnings, you can check them with CLIPPY=1. Besides, it'll be easy to review if you can split the changes into multiple patches. Thanks! Regards, Boqun > } > > /// Returns the UID of the given task. [...]