Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-29 Thread Matteo Croce
On Tue, Apr 23, 2019 at 5:28 AM Matteo Croce wrote: > > On April 19, 2019 10:07:14 AM GMT+09:00, Matthew Wilcox > wrote: > > On Fri, Apr 19, 2019 at 09:17:17AM +0900, Matteo Croce wrote: > > > > extern const int sysctl_zero; > > > > /* comment goes here */ > > > > #define SYSCTL_ZERO ((void

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-22 Thread Matteo Croce
On April 19, 2019 10:07:14 AM GMT+09:00, Matthew Wilcox wrote: > On Fri, Apr 19, 2019 at 09:17:17AM +0900, Matteo Croce wrote: > > > extern const int sysctl_zero; > > > /* comment goes here */ > > > #define SYSCTL_ZERO ((void *)_zero) > > > > > > and then use SYSCTL_ZERO everywhere. That

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-18 Thread Matthew Wilcox
On Fri, Apr 19, 2019 at 09:17:17AM +0900, Matteo Croce wrote: > > extern const int sysctl_zero; > > /* comment goes here */ > > #define SYSCTL_ZERO ((void *)_zero) > > > > and then use SYSCTL_ZERO everywhere. That centralizes the ugliness > > and > > makes it easier to switch over if/when

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-18 Thread Matteo Croce
On April 19, 2019 7:40:45 AM GMT+09:00, Andrew Morton wrote: > On Wed, 17 Apr 2019 15:15:31 +0200 Matteo Croce > wrote: > > > In the sysctl code the proc_dointvec_minmax() function is often used > to > > validate the user supplied value between an allowed range. This > function > > uses the

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-18 Thread Andrew Morton
On Wed, 17 Apr 2019 15:15:31 +0200 Matteo Croce wrote: > In the sysctl code the proc_dointvec_minmax() function is often used to > validate the user supplied value between an allowed range. This function > uses the extra1 and extra2 members from struct ctl_table as minimum and > maximum allowed

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-18 Thread Matteo Croce
On April 18, 2019 12:49:00 AM GMT+09:00, Matthew Wilcox wrote: > On Wed, Apr 17, 2019 at 03:15:31PM +0200, Matteo Croce wrote: > > In the sysctl code the proc_dointvec_minmax() function is often used > to > > validate the user supplied value between an allowed range. This > function > > uses the

Re: [PATCH v3] proc/sysctl: add shared variables for range check

2019-04-17 Thread Matthew Wilcox
On Wed, Apr 17, 2019 at 03:15:31PM +0200, Matteo Croce wrote: > In the sysctl code the proc_dointvec_minmax() function is often used to > validate the user supplied value between an allowed range. This function > uses the extra1 and extra2 members from struct ctl_table as minimum and > maximum

[PATCH v3] proc/sysctl: add shared variables for range check

2019-04-17 Thread Matteo Croce
In the sysctl code the proc_dointvec_minmax() function is often used to validate the user supplied value between an allowed range. This function uses the extra1 and extra2 members from struct ctl_table as minimum and maximum allowed value. On sysctl handler declaration, in every source file there