Re: [PATCH 08/10] mm: update fork mm->flags initialisation to use bitmap

Lorenzo Stoakes
2025-08-26T16:27:09Z

On Tue, Aug 26, 2025 at 05:53:36PM +0200, David Hildenbrand wrote:
> > OK right I see, in both cases BIT(32) is going to cause a warning on 32-bit.
> >
> > I was wrong in thinking (u64)(1UL << 32) would get fixed up because of the
> > outer cast I guess.
> >
> > This was the mistake here, so fine, we could do it this way.
> >
> > I guess I'll have to respin the series at this point.
>
> Let me think again: assuming someone would mess up the BIT() thing and
> convert back to 1 << NR, your variant would catch it on 32bit I guess.

Yeah and it should also catch the BIT() case albeit via warning :P

>
> So given I was primarily confused by the "u64" when talking about 32it, no
> need for a full resend of this series just to clean this up.

Yeah this isn't _terrible_ I don't think, although I was labouring under a
misapprehension (understandable - hopefully :) in the way the casting would
work, but of course you're right the ub would happen _prior_ to the u64 cast.

Anyway I think net we're getting the same result, and the comment makes clear
the intent, so I think yeah sort of fine as-is.

But I take your point absolutely :)

Cheers, Lorenzo