From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gary Guo" <gary@kernel.org>
Cc: "Gary Guo" <gary@garyguo.net>,
"Alice Ryhl" <aliceryhl@google.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"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>,
driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] rust: drm: fix non-const `read8` in unit test
Date: Fri, 17 Jul 2026 00:18:19 +0200 [thread overview]
Message-ID: <DK0CEDUBPRFN.UBM7NE1GGULP@kernel.org> (raw)
In-Reply-To: <20260716142545.3622278-2-gary@kernel.org>
On Thu Jul 16, 2026 at 4:25 PM CEST, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> With CONFIG_CC_OPTIMIZE_FOR_SIZE, the address validity check in non-const
> `read8` invocaction is not optimized away, leading to build failure.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>
Fixes: d055768429b3 ("rust: drm: gem: shmem: Add vmap functions")
> ---
> rust/kernel/drm/gem/shmem.rs | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
> index 580e0808d6c0..a687d46d170d 100644
> --- a/rust/kernel/drm/gem/shmem.rs
> +++ b/rust/kernel/drm/gem/shmem.rs
> @@ -688,7 +688,7 @@ fn vmap_io() -> Result {
> // Ensure the ordering in memory is correct
> let expected = 0xFEDCBA98_u32.to_ne_bytes().into_iter();
> for (offset, expected) in (0x20..=0x23).zip(expected) {
> - assert_eq!(vmap.read8(offset), expected);
> + assert_eq!(vmap.try_read8(offset).unwrap(), expected);
> }
>
> Ok(())
> --
> 2.54.0
next prev parent reply other threads:[~2026-07-16 22:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 14:25 [PATCH 1/2] rust: io: document const-offset requirement for infallible accessors Gary Guo
2026-07-16 14:25 ` [PATCH 2/2] rust: drm: fix non-const `read8` in unit test Gary Guo
2026-07-16 21:14 ` Alexandre Courbot
2026-07-16 22:18 ` Danilo Krummrich [this message]
2026-07-16 21:14 ` [PATCH 1/2] rust: io: document const-offset requirement for infallible accessors 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=DK0CEDUBPRFN.UBM7NE1GGULP@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gary@kernel.org \
--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