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

Kees Cook
2026-01-08T17:06:50Z

On Thu, Jan 08, 2026 at 07:52:15PM +0300, Dmitry Antipov 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.
>
> Suggested-by: Christoph Hellwig <hch@infradead.org>
> Suggested-by: Kees Cook <kees@kernel.org>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

LGTM, thanks!

Reviewed-by: Kees Cook <kees@kernel.org>

--
Kees Cook