Re: [PATCH v3 1/2] lib: introduce simple error-checking wrapper for memparse()

Andrew Morton
2026-01-20T00:06:24Z

On Thu, 8 Jan 2026 19:52:15 +0300 Dmitry Antipov <dmantipov@yandex.ru> wrote:

> Introduce 'memvalue()' which uses 'memparse()' to parse a string
> with optional memory suffix into a non-negative number. If parsing
> has succeeded, returns 0 and stores the result at the location
> specified by the second argument. Otherwise returns -EINVAL and
> leaves the location untouched.

Where do we stand with this patchset now? I saw a lot of discussion but
not a lot of clarity. Thanks.

Unrelated:

> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -319,6 +319,7 @@ DEFINE_FREE(argv_free, char **, if (!IS_ERR_OR_NULL(_T)) argv_free(_T))
> extern int get_option(char **str, int *pint);
> extern char *get_options(const char *str, int nints, int *ints);
> extern unsigned long long memparse(const char *ptr, char **retptr);
> +extern int __must_check memvalue(const char *ptr, unsigned long long *valptr);

Sensible.

> EXPORT_SYMBOL(memparse);
> +EXPORT_SYMBOL(memvalue);

memparse is used in many places. Seems inappropriate that these things
are implemented in lib/cmdline.c?