Re: [PATCH] rust: types: add FOREIGN_ALIGN to ForeignOwnable

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

 



On 6/5/25 9:55 PM, Andreas Hindborg wrote:
The current implementation of `ForeignOwnable` is leaking the type of the
opaque pointer to consumers of the API. This allows consumers of the opaque
pointer to rely on the information that can be extracted from the pointer
type.

To prevent this, change the API to the version suggested by Maira
Canal (link below): Remove `ForeignOwnable::PointedTo` in favor of a
constant, which specifies the alignment of the pointers returned by
`into_foreign`.

Suggested-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Suggested-by: Maíra Canal <mcanal@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20240309235927.168915-3-mcanal@xxxxxxxxxx
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>

I think having the pointer type be `crate::ffi::c_void` was much more convenient
for users of the API anyways. :)

	Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>




[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