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

Uwe Kleine-König (The Capable Hub)
2026-04-22T08:39:13Z

[-- Attachment #1: Type: text/plain, Size: 1577 bytes --]

On Wed, Apr 22, 2026 at 09:52:11AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 21, 2026 at 10:12:41AM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > On Mon, Apr 20, 2026 at 04:46:56PM -0400, Luiz Augusto von Dentz wrote:
> > > On Mon, Apr 20, 2026 at 4:31 PM Uwe Kleine-König (The Capable Hub)
> > > <u.kleine-koenig@baylibre.com> wrote:
> > > > On Fri, Apr 17, 2026 at 03:10:47PM +0200, Uwe Kleine-König (The Capable Hub) wrote:
> > > > > On all current Linux architectures sizeof(long) == sizeof(void *) and
> > > > > this is used a lot through the kernel. For example it enables the usual
> > > > > practice to store pointers in sdio_driver_id's .driver_data member.
> > > > >
> > > > > This works fine, but involves casting and thus isn't type-safe.
> >
> > 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.

Then I'm lucky that this patch set doesn't introduce uintptr_t and so we
can delay the discussion with Linus about that. (And we will have to
hold that discussion at some point, because on CHERI we have
sizeof(unsigned long) = 8 < sizeof(void *) = 16. I didn't check, but I
think also unsigned long long cannot hold a void*.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]