From: Klara Modin <klarasmodin@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org, ojeda@kernel.org,
rust-for-linux@vger.kernel.org, amd-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org, "David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Alice Ryhl" <aliceryhl@google.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Mukul Joshi" <mukul.joshi@amd.com>,
"Felix Kuehling" <felix.kuehling@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Thorsten Leemhuis" <linux@leemhuis.info>,
"Manuel Ebner" <manuelebner@mailbox.org>,
"Gary Guo" <gary@garyguo.net>
Subject: Re: [PATCH] rust/drm/gem: initialize callbacks with ..pin_init::zeroed()
Date: Tue, 8 Sep 2026 21:25:46 +0200 [thread overview]
Message-ID: <aqBf1UYNR-Q3T-cs@soda.int.kasm.eu> (raw)
In-Reply-To: <aqBdJY43QlnN5wnx@soda.int.kasm.eu>
On 2026-09-08 21:09:40 +0200, Klara Modin wrote:
> On 2026-09-08 20:57:05 +0200, Klara Modin wrote:
> > On 2026-09-08 18:05:54 +0000, sashiko-bot@kernel.org wrote:
> > > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > > - [Medium] Incomplete fix: missing `handle_free` field in conditionally compiled `shmem.rs`.
> > > --
> > >
> > > commit b5b83bb373847c99ca6d286c268d2e0ffab299f0
> > > Author: Klara Modin <klarasmodin@gmail.com>
> > >
> > > rust/drm/gem: initialize callbacks with ..pin_init::zeroed()
> > >
> > > This commit updates the drm_gem_object_funcs struct initialization in the DRM
> > > GEM module to use pin_init::zeroed() instead of explicitly assigning None to
> > > unused callbacks. This fixes a build failure caused by a newly added callback
> > > field in the C structure.
> > >
> > > Closes: https://lore.kernel.org/all/aaef18cd-ab55-4fb8-8563-ca3a5ea9cbc6@leemhuis.info
> > >
> > > > diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> > > > index e1ebad77ebe2a..c63b0fe5a15e1 100644
> > > > --- a/rust/kernel/drm/gem/mod.rs
> > > > +++ b/rust/kernel/drm/gem/mod.rs
> > > > @@ -266,18 +266,8 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, Ctx> {
> > > > free: Some(Self::free_callback),
> > > > open: Some(open_callback::<T>),
> > > > close: Some(close_callback::<T>),
> > > > - print_info: None,
> > > > - export: None,
> > > > - pin: None,
> > > > - unpin: None,
> > > > - get_sg_table: None,
> > > > - vmap: None,
> > > > - vunmap: None,
> > > > - mmap: None,
> > > > - status: None,
> > > > vm_ops: core::ptr::null_mut(),
> > > > - evict: None,
> > > > - rss: None,
> > > > + ..pin_init::zeroed()
> > > > };
> > >
> > > [Severity: Medium]-
> > > Does this commit miss a similar update in rust/kernel/drm/gem/shmem.rs?
> > >
> > > The VTABLE initialization in shmem.rs explicitly lists fields without
> > > using pin_init::zeroed(), similar to what was fixed here. When compiling
> > > with CONFIG_RUST_DRM_GEM_SHMEM_HELPER=y, won't this cause a missing
> > > field error for the newly added handle_free callback?
> >
> > Sure, but it should probably be a different patch in that case. The
> > current patch fixes an issue to a currently existing build failure,
> > while the issue mentioned here has not manifested yet.
>
> On second thought, this is seems to be using the same binding so this
> might be accurate.
Confirmed, on an arm64 build with the Tyr driver enabled:
error[E0063]: missing field `handle_free` in initializer of `drm_gem_object_funcs`
--> /home/klara/git/linux/trees/next-local/rust/kernel/drm/gem/shmem.rs:130:52
|
130 | const VTABLE: bindings::drm_gem_object_funcs = bindings::drm_gem_object_funcs {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `handle_free`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0063`.
I'll wait a while for other thoughts and otherwise respin with this
included.
>
> >
> > Regards,
> > Klara Modin
> >
> > >
> > > rust/kernel/drm/gem/shmem.rs:
> > > const VTABLE: bindings::drm_gem_object_funcs = bindings::drm_gem_object_funcs {
> > > free: Some(Self::free_callback),
> > > open: Some(super::open_callback::<T>),
> > > close: Some(super::close_callback::<T>),
> > > print_info: Some(bindings::drm_gem_shmem_object_print_info),
> > > export: None,
> > > pin: Some(bindings::drm_gem_shmem_object_pin),
> > > unpin: Some(bindings::drm_gem_shmem_object_unpin),
> > > get_sg_table: Some(bindings::drm_gem_shmem_object_get_sg_table),
> > > vmap: Some(bindings::drm_gem_shmem_object_vmap),
> > > vunmap: Some(bindings::drm_gem_shmem_object_vunmap),
> > > mmap: Some(bindings::drm_gem_shmem_object_mmap),
> > > status: None,
> > > rss: None,
> > > #[allow(unused_unsafe, reason = "Safe since Rust 1.82.0")]
> > > // SAFETY: drm_gem_shmem_vm_ops is a valid, static const on the C side.
> > > vm_ops: unsafe { &raw const bindings::drm_gem_shmem_vm_ops },
> > > evict: None,
> > > };
> > >
> > > --
> > > Sashiko AI review · https://sashiko.dev/#/patchset/20260908175427.47207-1-klarasmodin@gmail.com?part=1
next prev parent reply other threads:[~2026-09-08 19:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 17:54 [PATCH] rust/drm/gem: initialize callbacks with ..pin_init::zeroed() Klara Modin
[not found] ` <20260908180555.0830E1F00A3A@smtp.kernel.org>
2026-09-08 18:57 ` Klara Modin
2026-09-08 19:09 ` Klara Modin
2026-09-08 19:25 ` Klara Modin [this message]
2026-09-08 20:50 ` Gary Guo
2026-09-09 8:01 ` Thomas Zimmermann
2026-09-09 8:05 ` Miguel Ojeda
2026-09-09 8:11 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aqBf1UYNR-Q3T-cs@soda.int.kasm.eu \
--to=klarasmodin@gmail.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=aliceryhl@google.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=felix.kuehling@amd.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@leemhuis.info \
--cc=manuelebner@mailbox.org \
--cc=mukul.joshi@amd.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox