On Wed, Feb 12, 2025 at 03:47:11PM -0500, Tamir Duberstein wrote: > Looks like I wasn't the only one to fall into the trap (rust/kernel/io.rs): > > #[inline] > const fn io_addr_assert<U>(&self, offset: usize) -> usize { > build_assert!(Self::offset_valid::<U>(offset, SIZE)); > > self.addr() + offset > } > > since offset isn't known at compile time, this can easily be misused? Well, that's intentional. iomem.readb(0x0) // succeeds if SIZE >=1 iomem.readb(foo) // fails if foo is not known at compile time iomem.try_readb(foo) // succeeds if self.maxsize() >= 1