Re: [PATCH v2] sched: check user input value of sysctl_sched_time_avg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 02, 2017 at 02:57:32PM +0800, Ethan Zhao wrote:
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 6648fbb..609bed2 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -367,7 +367,7 @@ static int sysrq_sysctl_handler(struct ctl_table *table, int write,
>  		.data		= &sysctl_sched_time_avg,
>  		.maxlen		= sizeof(unsigned int),
>  		.mode		= 0644,
> -		.proc_handler	= proc_dointvec,
> +		.proc_handler	= sched_time_avg_handler,

*sigh*, what's wrong with the below? Too easy?

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6648fbbb8157..bbbc6a17c15e 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -367,7 +367,8 @@ static struct ctl_table kern_table[] = {
 		.data		= &sysctl_sched_time_avg,
 		.maxlen		= sizeof(unsigned int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_dointvec_min_max,
+		.extra1		= &one,
 	},
 #ifdef CONFIG_SCHEDSTATS
 	{




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux