sched/deadline: Use proc_douintvec_minmax() limit minimum value
authorYajun Deng <yajun.deng@linux.dev>
Tue, 7 Jun 2022 10:18:07 +0000 (18:18 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 13 Jun 2022 08:30:00 +0000 (10:30 +0200)
commit2ed81e765417ec2526f901366167a13294ef09ce
tree9f30c3f54d330a73ec7225418039a6d111293516
parent51bf903b64bdde4e4c9009a9e2b4a589845d9d81
sched/deadline: Use proc_douintvec_minmax() limit minimum value

sysctl_sched_dl_period_max and sysctl_sched_dl_period_min are unsigned
integer, but proc_dointvec() wouldn't return error even if we set a
negative number.

Use proc_douintvec_minmax() instead of proc_dointvec(). Add extra1 for
sysctl_sched_dl_period_max and extra2 for sysctl_sched_dl_period_min.

It's just an optimization for match data and proc_handler in struct
ctl_table. The 'if (period < min || period > max)' in __checkparam_dl()
will work fine even if there hasn't this patch.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Link: https://lore.kernel.org/r/20220607101807.249965-1-yajun.deng@linux.dev
kernel/sched/deadline.c