Re: [PATCH v3 2/2] drm/tyr: safely write GpuInfo to userspace
From: Deborah Brouwer
Date: Mon Oct 05 2026 - 18:51:18 EST
On Sat, Sep 26, 2026 at 06:48:49PM +0200, Danilo Krummrich wrote:
> On Sat Sep 26, 2026 at 2:26 AM CEST, Deborah Brouwer wrote:
> > @@ -54,7 +54,7 @@ pub(crate) fn dev_query(
> > )
> > .writer();
> >
> > - writer.write(®_data.gpu_info)?;
> > + writer.write_slice(reg_data.gpu_info.as_bytes())?;
>
> I think we eventually want write() to require T: IntoBytes + Immutable, so I'm
> not sure there is much value going back and forth with this.
We could change UserSliceWriter::write to require T: IntoBytes + Immutable, but since
rust_binder_main.rs uses UserSliceWriter also, it’s not a trivial change.
There is value in changing this for Tyr because currently Tyr has an unsafe
implementation of AsBytes and since the panthor uapi is under development I think it
would be nicer to have a compile time check.