[PATCH] sysctl: drop the pointer dance in proc_put_char()
Bradley Morgan <[email protected]>
| Newsgroups | org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
proc_put_char() still drags around a char **buffer alias, writing
the char through it, advancing it, then copying it back into the
slot it was loaded from. That only made sense when the buffer was
__user and the char went through put_user() (which could fail).
Since commit 32927393dc1c ("sysctl: pass kernel pointers to
->proc_handler") the buffer is just a kernel pointer, so the alias
is dead weight. proc_put_long() and the skip helpers already advance
*buf directly, so do the same here. No functional change.
Signed-off-by: Bradley Morgan <[email protected]>
---
kernel/sysctl.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f7b7598..2b92b30 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -350,12 +350,9 @@ static void proc_put_long(void **buf, size_t *size, unsigned long val, bool neg)
static void proc_put_char(void **buf, size_t *size, char c)
{
if (*size) {
- char **buffer = (char **)buf;
- **buffer = c;
-
+ *(char *)*buf = c;
(*size)--;
- (*buffer)++;
- *buf = *buffer;
+ (*buf)++;
}
}
--
2.47.3