[PATCH 05/14] sysrq,sysctl: remove proc input checks out of sysctl handlers

From: Sasha Levin
Date: Sun Apr 29 2012 - 02:47:44 EST


Simplify sysctl handler by removing user input checks and using the callback
provided by the sysctl table.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
kernel/sysctl.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 40be238..bde6087 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -178,18 +178,9 @@ static int proc_dointvec_minmax_sysadmin(struct ctl_table *table, int write,
/* Note: sysrq code uses it's own private copy */
static int __sysrq_enabled = SYSRQ_DEFAULT_ENABLE;

-static int sysrq_sysctl_handler(ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
- loff_t *ppos)
+static int sysrq_sysctl_handler(void)
{
- int error;
-
- error = proc_dointvec(table, write, buffer, lenp, ppos);
- if (error)
- return error;
-
- if (write)
- sysrq_toggle_support(__sysrq_enabled);
+ sysrq_toggle_support(__sysrq_enabled);

return 0;
}
@@ -594,7 +585,8 @@ static struct ctl_table kern_table[] = {
.data = &__sysrq_enabled,
.maxlen = sizeof (int),
.mode = 0644,
- .proc_handler = sysrq_sysctl_handler,
+ .proc_handler = proc_dointvec,
+ .callback = sysrq_sysctl_handler,
},
#endif
#ifdef CONFIG_PROC_SYSCTL
--
1.7.8.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/