mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 06:24:53 +08:00
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
This commit is contained in:
parent
51bf903b64
commit
2ed81e7654
@ -30,14 +30,16 @@ static struct ctl_table sched_dl_sysctls[] = {
|
||||
.data = &sysctl_sched_dl_period_max,
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec,
|
||||
.proc_handler = proc_douintvec_minmax,
|
||||
.extra1 = (void *)&sysctl_sched_dl_period_min,
|
||||
},
|
||||
{
|
||||
.procname = "sched_deadline_period_min_us",
|
||||
.data = &sysctl_sched_dl_period_min,
|
||||
.maxlen = sizeof(unsigned int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec,
|
||||
.proc_handler = proc_douintvec_minmax,
|
||||
.extra2 = (void *)&sysctl_sched_dl_period_max,
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user