* Re: [PATCH 2/2] rust: drm: fix non-const `read8` in unit test
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
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2026-07-16 21:14 UTC (permalink / raw)
To: Gary Guo
Cc: Gary Guo, Danilo Krummrich, Alice Ryhl, Daniel Almeida,
Miguel Ojeda, Boqun Feng, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Trevor Gross, Tamir Duberstein, Onur Özkan,
David Airlie, Simona Vetter, driver-core, rust-for-linux,
linux-kernel, dri-devel
On Thu Jul 16, 2026 at 7:25 AM PDT, 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>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] rust: drm: fix non-const `read8` in unit test
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
1 sibling, 0 replies; 3+ messages in thread
From: Danilo Krummrich @ 2026-07-16 22:18 UTC (permalink / raw)
To: Gary Guo
Cc: Gary Guo, Alice Ryhl, Daniel Almeida, Miguel Ojeda, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Trevor Gross, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, David Airlie, Simona Vetter, driver-core,
rust-for-linux, linux-kernel, dri-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread