On Mon, May 11, 2026 at 11:55:40AM -0400, Michael S. Tsirkin wrote:
> On Mon, May 11, 2026 at 11:37:37AM -0400, Gregory Price wrote:
> > On Mon, May 11, 2026 at 05:01:55AM -0400, Michael S. Tsirkin wrote:
> > 
> > > +/*
> > > + * Sentinel for user_addr: indicates a non-user allocation.
> > > + * Cannot use 0 because address 0 is a valid userspace mapping.
> > > + */
> > > +#define USER_ADDR_NONE   ((unsigned long)-1)
> > 
> > Ehm, hm.  Does -1 hold as a non-user address across all architectures?
> > 
> > What about in linear addressing / no VM mode?
> 
> this is used on a fault. I don't think there are any faults then?
> But maybe FAULT_ADDR_NONE would be clearer.
>

Meh, naming here is less relevant than the sentinel correctness.

My only concern is really whether -1 could end up being a valid address
in some horrid future timeline and this all going belly up.

Is why I asked about whether this is correct on all architectures.

> > So the trade off is:
> >    a) churn the current interface for everyone
> >    b) add a user_ variant and know people will just get it wrong
> 
> I was also explicitly asked not to proliferate too many new APIs.
>

Yeah simply spelling it out, not asking for a change.  Probably no
better way to go about it.

~Gregory

Reply via email to