Re: [PATCH] base: devcoredump: Replace simple_strtol with kstrtol
From: Greg KH
Date: Mon Jul 20 2026 - 09:12:48 EST
On Mon, Jul 20, 2026 at 08:50:35PM +0800, Jiangshan Yi wrote:
> The disabled_store() function uses simple_strtol(), which is marked
> obsolete. simple_strtol() does not provide error handling on invalid
> input - it silently returns a partial parse result or 0, which the
> 'if (tmp != 1) return -EINVAL' check then accepts as a legitimate
> non-1 value.
>
> Replace simple_strtol(buf, NULL, 10) with kstrtol(buf, 10, &tmp),
> which returns an error code on invalid input. This makes the write-once
> lockdown attribute stricter: malformed input (e.g. trailing garbage)
> now returns -EINVAL instead of being silently treated as a non-1 value
> that the caller wanted to reject anyway.
Be careful, we are rejecting ABI changes like this as there is no real
reason to change this at this point in time, right?
thanks,
greg k-h