Re: [PATCH 23/79] block: rust: change sector type from usize to u64

Alice Ryhl
2026-03-16T10:56:22Z

On Mon, Feb 16, 2026 at 12:35:10AM +0100, Andreas Hindborg wrote:
> Change the `sector()` and `sectors()` methods in `Request` to return
> `u64` and `u32` respectively instead of `usize`. This matches the
> underlying kernel types.
>
> Update rnull driver to handle the new sector types with appropriate
> casting throughout the read, write, and discard operations.
>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

This has lots of unchecked casts from u64 to usize, which could overflow
on 32-bit systems. Could use some CAST: comments or similar.

Alice