Re: [PATCH RESEND] x86/mtrr: Replace simple_strtoul with kstrtoul in parse_mtrr_spare_reg
From: Thorsten Blum
Date: Sun Mar 01 2026 - 11:41:21 EST
On 28. Feb 2026, at 15:58, Borislav Petkov wrote:
> On Tue, Jan 27, 2026 at 10:58:23PM +0100, Thorsten Blum wrote:
>> Replace simple_strtoul() with the recommended kstrtoul() for parsing the
>> 'mtrr_spare_reg_nr' boot parameter.
>>
>> Check the return value of kstrtoul() and reject invalid values.
>
> Where?
The check is implicit in the return statement. Previously,
parse_mtrr_spare_reg() always returned 0 (success). Returning kstrtoul()
directly propagates 0 on success and -errno on failure, which adds
proper error handling.
However, I realized that 'arg' can be NULL here, so the NULL check
cannot be removed. I'll send a v2.
Thanks,
Thorsten