From: Alice Ryhl <aliceryhl@google.com>
To: Deborah Brouwer <deborah.brouwer@collabora.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/tyr: allow userspace buffers to be mismatched
Date: Fri, 16 Oct 2026 09:37:42 +0000 [thread overview]
Message-ID: <atHwZg245MM7l9Ty@google.com> (raw)
In-Reply-To: <20261015-b4-dev_query_fixes-v2-2-e3e6d25050cb@collabora.com>
On Thu, Oct 15, 2026 at 11:35:21AM -0700, Deborah Brouwer wrote:
> +// If the user buffer is at least the minimum required size, then
> +// copy as much of the kernel object as will fit into the user buffer.
> +// Don't fail if the user buffer is smaller than the kernel object.
> +// If the user buffer is bigger than needed, zero out the remainder.
> +fn set_uobj<T: AsBytes>(usr_dst: u64, size: u32, min_size: usize, src_obj: &T) -> Result {
> + if (size as usize) < min_size {
> + return Err(EINVAL);
Use `kernel::num::casts::u32_as_usize` here.
> + }
> +
> + let mut writer = UserSlice::new(UserPtr::from_addr(usr_dst as usize), size as usize).writer();
Avoid casting to usize twice.
let size = kernel::num::casts::u32_as_usize(size);
Alice
next prev parent reply other threads:[~2026-10-16 9:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 18:35 [PATCH v2 0/2] drm/tyr: allow mismatched buffers for dev_query Deborah Brouwer
2026-10-15 18:35 ` [PATCH v2 1/2] rust: uaccess: add UserSliceWriter::clear() Deborah Brouwer
2026-10-16 8:02 ` Alice Ryhl
2026-10-15 18:35 ` [PATCH v2 2/2] drm/tyr: allow userspace buffers to be mismatched Deborah Brouwer
2026-10-16 9:37 ` Alice Ryhl [this message]
2026-10-17 1:36 ` Alexandre Courbot
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=atHwZg245MM7l9Ty@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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