Re: [PATCH v4 6/6] rust: use strict provenance APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 16, 2025 at 1:01 AM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
>
> On Sat, Mar 15, 2025 at 08:17:30AM -0400, Tamir Duberstein wrote:
> [...]
> > diff --git a/rust/kernel/of.rs b/rust/kernel/of.rs
> > index 40d1bd13682c..f9459694cbdc 100644
> > --- a/rust/kernel/of.rs
> > +++ b/rust/kernel/of.rs
> > @@ -22,7 +22,7 @@ unsafe impl RawDeviceId for DeviceId {
> >      const DRIVER_DATA_OFFSET: usize = core::mem::offset_of!(bindings::of_device_id, data);
> >
> >      fn index(&self) -> usize {
> > -        self.0.data as usize
> > +        crate::expose_provenance(self.0.data)
>
> Even though of_device_id::data was defined as `void *`, but in Rust we
> use it to store index, see kernel::device_id::{IdTable::info(),
> IdArray::new()}. Hence we should use self.0.data.addr() here.

Good point, thanks.





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux