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); -- Kees Cook
