Re: [PATCH] tick/sched: check skew_tick kernel parameter's validity
From: Sergey Shtylyov
Date: Wed Sep 30 2026 - 18:57:01 EST
On 9/29/26 11:01 PM, Thomas Gleixner wrote:
[...]>> In skew_tick(), the result of get_option() call is ignored, so even if a
>> value of the skew_tick kernel parameter was not specified (or specified
>> as a list or range), the kernel won't complain. Add the missing check...
>>
>> Found by Linux Verification Center (linuxtesting.org) with the Svace static
>> analysis tool.
>>
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@xxxxxxxxxxxx>
>>
>> ---
>> The patch is against the timers/nohz branch of the tip.git repo...
>>
>> kernel/time/tick-sched.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
>> index c1ee0b256445..34ceccdd49b5 100644
>> --- a/kernel/time/tick-sched.c
>> +++ b/kernel/time/tick-sched.c
>> @@ -1483,7 +1483,8 @@ static int sched_skew_tick;
>>
>> static int __init skew_tick(char *str)
>> {
>> - get_option(&str, &sched_skew_tick);
>> + if (get_option(&str, &sched_skew_tick) != 1)
>> + return -EINVAL;
>>
>> return 0;
>> }
>
> sched_skew_tick should be converted to bool and this function should
> simply do:
>
> return kstrtobool(str, &sched_skew_tick);
Thanks for your comment!
OK, I'll do that (and add the Suggested-by: tag, of/c)...
> And to make it complete, sched_skew_tick should be annotated with
> ro_after_init.
I guess you meant __ro_after_init? Would it then be OK adding it
in the same patch?
> Thanks,
>
> tglx
MBR, Sergey