aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2018-04-10 19:35:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-11 13:28:38 -0400
commit24704f36196ce79b48dd3921e782d15fd9c87959 (patch)
treebb270889b77b6e1886285108326520fccc4af77a
parent64a11f3dc20b45fdc8c058296b4f6449e4b9f24c (diff)
kernel/sysctl.c: add kdoc comments to do_proc_do{u}intvec_minmax_conv_param
Kdoc comments are added to the do_proc_dointvec_minmax_conv_param and do_proc_douintvec_minmax_conv_param structures thare are used internally for range checking. The error codes returned by proc_dointvec_minmax() and proc_douintvec_minmax() are also documented. Link: http://lkml.kernel.org/r/1519926220-7453-3-git-send-email-longman@redhat.com Signed-off-by: Waiman Long <longman@redhat.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Luis R. Rodriguez <mcgrof@kernel.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Kees Cook <keescook@chromium.org> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/sysctl.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index a2854f6e0743..6a78cf70761d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2511,6 +2511,15 @@ static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
2511} 2511}
2512#endif 2512#endif
2513 2513
2514/**
2515 * struct do_proc_dointvec_minmax_conv_param - proc_dointvec_minmax() range checking structure
2516 * @min: pointer to minimum allowable value
2517 * @max: pointer to maximum allowable value
2518 *
2519 * The do_proc_dointvec_minmax_conv_param structure provides the
2520 * minimum and maximum values for doing range checking for those sysctl
2521 * parameters that use the proc_dointvec_minmax() handler.
2522 */
2514struct do_proc_dointvec_minmax_conv_param { 2523struct do_proc_dointvec_minmax_conv_param {
2515 int *min; 2524 int *min;
2516 int *max; 2525 int *max;
@@ -2554,7 +2563,7 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
2554 * This routine will ensure the values are within the range specified by 2563 * This routine will ensure the values are within the range specified by
2555 * table->extra1 (min) and table->extra2 (max). 2564 * table->extra1 (min) and table->extra2 (max).
2556 * 2565 *
2557 * Returns 0 on success. 2566 * Returns 0 on success or -EINVAL on write when the range check fails.
2558 */ 2567 */
2559int proc_dointvec_minmax(struct ctl_table *table, int write, 2568int proc_dointvec_minmax(struct ctl_table *table, int write,
2560 void __user *buffer, size_t *lenp, loff_t *ppos) 2569 void __user *buffer, size_t *lenp, loff_t *ppos)
@@ -2567,6 +2576,15 @@ int proc_dointvec_minmax(struct ctl_table *table, int write,
2567 do_proc_dointvec_minmax_conv, &param); 2576 do_proc_dointvec_minmax_conv, &param);
2568} 2577}
2569 2578
2579/**
2580 * struct do_proc_douintvec_minmax_conv_param - proc_douintvec_minmax() range checking structure
2581 * @min: pointer to minimum allowable value
2582 * @max: pointer to maximum allowable value
2583 *
2584 * The do_proc_douintvec_minmax_conv_param structure provides the
2585 * minimum and maximum values for doing range checking for those sysctl
2586 * parameters that use the proc_douintvec_minmax() handler.
2587 */
2570struct do_proc_douintvec_minmax_conv_param { 2588struct do_proc_douintvec_minmax_conv_param {
2571 unsigned int *min; 2589 unsigned int *min;
2572 unsigned int *max; 2590 unsigned int *max;
@@ -2614,7 +2632,7 @@ static int do_proc_douintvec_minmax_conv(unsigned long *lvalp,
2614 * check for UINT_MAX to avoid having to support wrap around uses from 2632 * check for UINT_MAX to avoid having to support wrap around uses from
2615 * userspace. 2633 * userspace.
2616 * 2634 *
2617 * Returns 0 on success. 2635 * Returns 0 on success or -ERANGE on write when the range check fails.
2618 */ 2636 */
2619int proc_douintvec_minmax(struct ctl_table *table, int write, 2637int proc_douintvec_minmax(struct ctl_table *table, int write,
2620 void __user *buffer, size_t *lenp, loff_t *ppos) 2638 void __user *buffer, size_t *lenp, loff_t *ppos)