]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - net/sunrpc/sysctl.c
sysctl: pass kernel pointers to ->proc_handler
[mirror_ubuntu-hirsute-kernel.git] / net / sunrpc / sysctl.c
index d75f17b56f0e17ee52b5703429ef5e1366da6475..999eee1ed61c9c0b694a03bbf3bc6b7ea1e53274 100644 (file)
@@ -60,7 +60,7 @@ rpc_unregister_sysctl(void)
 }
 
 static int proc_do_xprt(struct ctl_table *table, int write,
-                       void __user *buffer, size_t *lenp, loff_t *ppos)
+                       void *buffer, size_t *lenp, loff_t *ppos)
 {
        char tmpbuf[256];
        size_t len;
@@ -70,15 +70,15 @@ static int proc_do_xprt(struct ctl_table *table, int write,
                return 0;
        }
        len = svc_print_xprts(tmpbuf, sizeof(tmpbuf));
-       return simple_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
+       return memory_read_from_buffer(buffer, *lenp, ppos, tmpbuf, len);
 }
 
 static int
-proc_dodebug(struct ctl_table *table, int write,
-                               void __user *buffer, size_t *lenp, loff_t *ppos)
+proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp,
+            loff_t *ppos)
 {
-       char            tmpbuf[20], c, *s = NULL;
-       char __user *p;
+       char            tmpbuf[20], *s = NULL;
+       char *p;
        unsigned int    value;
        size_t          left, len;
 
@@ -90,18 +90,17 @@ proc_dodebug(struct ctl_table *table, int write,
        left = *lenp;
 
        if (write) {
-               if (!access_ok(buffer, left))
-                       return -EFAULT;
                p = buffer;
-               while (left && __get_user(c, p) >= 0 && isspace(c))
-                       left--, p++;
+               while (left && isspace(*p)) {
+                       left--;
+                       p++;
+               }
                if (!left)
                        goto done;
 
                if (left > sizeof(tmpbuf) - 1)
                        return -EINVAL;
-               if (copy_from_user(tmpbuf, p, left))
-                       return -EFAULT;
+               memcpy(tmpbuf, p, left);
                tmpbuf[left] = '\0';
 
                value = simple_strtol(tmpbuf, &s, 0);
@@ -121,11 +120,9 @@ proc_dodebug(struct ctl_table *table, int write,
                len = sprintf(tmpbuf, "0x%04x", *(unsigned int *) table->data);
                if (len > left)
                        len = left;
-               if (copy_to_user(buffer, tmpbuf, len))
-                       return -EFAULT;
+               memcpy(buffer, tmpbuf, len);
                if ((left -= len) > 0) {
-                       if (put_user('\n', (char __user *)buffer + len))
-                               return -EFAULT;
+                       *((char *)buffer + len) = '\n';
                        left--;
                }
        }