Re: [PATCH] rust_binder: use pin_init::zeroed for file_operations initialization

Alice Ryhl <[email protected]> Thu, 2 Jul 2026 11:09:22 +0000
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Tue, Jun 30, 2026 at 12:43:25PM -0300, Nicolás Antinori wrote:
> On Sun Jun 28, 2026 at 7:16 AM -03, Miguel Ojeda wrote:
> > On Fri, Jun 26, 2026 at 11:44 PM Nicolás Antinori
> > <[email protected]> wrote:
> >>
> >> -    // SAFETY: All zeroes is safe for the `file_operations` type.
> >> -    let zeroed_ops = unsafe { core::mem::MaybeUninit::zeroed().assume_init() };
> >> +    let zeroed_ops = pin_init::zeroed();
> >
> > I would just remove the variable and put `zeroed()` directly in the
> > fops initializer like we do in other cases, but it is fine of course.
> 
> I thought of that as well but I tried to touch as little as possible (I
> assumed that was in a variable for a reason). I can send a v2 if that is 
> preferred!

I think it was extracted to a variable for line length reasons. You can
remove the variable if you want.

Alice