[PATCH v1 1/6] sdio: Add syntactic sugar to store a pointer in sdio_driver_id

Christian A. Ehrhardt lk at c--e.de
Wed Apr 22 03:56:01 PDT 2026


Hi,

On Wed, Apr 22, 2026 at 09:52:11AM +0300, Andy Shevchenko wrote:
> > To be honest, with the involved void* this isn't really type-safe
> > either, but at least the data keeps being a pointer which is really
> > helpful on CHERI. FTR: The alternative would be to use uintptr_t instead
> > of unsigned long, which also has proponents in the CHERI community and
> > which is used in the current vendor patch stack.
> 
> FWIW, Linus categorically told that it has to be no uintptr_t in the
> Linux kernel.

This is probably not the correct context to discuss this but
I will point out that if/when CHERI support is added to the
kernel we will need a way to distinguish between
* A (fat) pointer converted to an integer type (in order to do
  integer arithmetic on the address) that might be converted back
  to a pointer in the future and
* A plain address "extracted" from a fat pointer.
Using `uintptr_t` for the former and `unsigned long` for the
latter seems like a reasonable choice but there are certainly
other options.

Sorting out the difference between the two is a very large
part of the diff required to port Linux (or in fact any piece
of low-level software) to a CHERI system.

Best regards,
Christian





More information about the Linux-mediatek mailing list