On Wed, Jan 07, 2026 at 12:08:54PM -0800, Kees Cook wrote: > On Wed, Jan 07, 2026 at 09:36:13PM +0300, Dmitry Antipov wrote: > > Introduce 'memvalue()' which uses 'memparse()' to parse a string with > > optional memory suffix into a number and returns this number or ULLONG_MAX > > if the number is negative or an unrecognized character was encountered. > > ULLONG_MAX is a valid address, though. I don't like this as an error > canary. How about using __must_check with 0/negative return value and > put the parsed value into a passed-by-reference variable instead? This > has the benefit of also performing type checking on the variable so that > a returned value can never be truncated accidentally: > > > int __must_check memvalue(const char *ptr, unsigned long long *addr);
That does sound pretty nice as an API. Should addr better be an u64 instead of unsligned long long, though?
