Re: [PATCH v4 2/2] drm/tyr: safely write GpuInfo to userspace

From: Alice Ryhl

Date: Tue Oct 20 2026 - 04:04:52 EST


On Mon, Oct 19, 2026 at 04:26:00PM -0700, Deborah Brouwer wrote:
> diff --git a/drivers/gpu/drm/tyr/gpu.rs b/drivers/gpu/drm/tyr/gpu.rs
> index e1b04a0c5159..4808bcbcc3b9 100644
> --- a/drivers/gpu/drm/tyr/gpu.rs
> +++ b/drivers/gpu/drm/tyr/gpu.rs
> @@ -28,6 +27,8 @@
> }, //
> };
>
> +use zerocopy_derive::Immutable;
> +
> /// Struct containing information that can be queried by userspace. This is read from
> /// the GPU's registers.
> ///
> @@ -35,7 +36,7 @@
> ///
> /// - The layout of this struct is identical to the C `struct drm_panthor_gpu_info`.
> #[repr(transparent)]
> -#[derive(Clone, Copy)]
> +#[derive(Clone, Copy, IntoBytes, Immutable)]
> pub(crate) struct GpuInfo(pub(crate) uapi::drm_panthor_gpu_info);

Two tiny optional nits since you'll need a v5 for patch 1:

* `use zerocopy_derive::Immutable;` can be placed above `use crate::{`
with the external crate imports.
* Now that `unsafe impl AsBytes for GpuInfo {}` is removed, nothing
relies on `GpuInfo`'s `# Invariants` doc section anymore, so that
comment block can be dropped too.

Otherwise this looks good to me. Feel free to keep my R-b on v5 with or
without those tweaks:

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Alice