]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
module: make perm const
authorDan Streetman <ddstreet@ieee.org>
Tue, 16 Jun 2015 20:47:52 +0000 (06:17 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 23 Jun 2015 05:57:37 +0000 (15:27 +0930)
Change the struct kernel_param.perm field to a const, as it should never
be changed.

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cut from larger patch)
include/linux/moduleparam.h
kernel/params.c

index 7e00799363968dc82127e51d4528b4f761ee4302..ab503145380787906bdcba3229e6bb853db4fd2d 100644 (file)
@@ -68,7 +68,7 @@ enum {
 struct kernel_param {
        const char *name;
        const struct kernel_param_ops *ops;
 struct kernel_param {
        const char *name;
        const struct kernel_param_ops *ops;
-       u16 perm;
+       const u16 perm;
        s8 level;
        u8 flags;
        union {
        s8 level;
        u8 flags;
        union {
index e906874da5fc55972d47083fa00c833b52595b5c..a8b09f6c87dc40e7f6d2c50aaf9a8e718a14a987 100644 (file)
@@ -395,12 +395,11 @@ EXPORT_SYMBOL(param_ops_invbool);
 
 int param_set_bint(const char *val, const struct kernel_param *kp)
 {
 
 int param_set_bint(const char *val, const struct kernel_param *kp)
 {
-       struct kernel_param boolkp;
+       /* Match bool exactly, by re-using it. */
+       struct kernel_param boolkp = *kp;
        bool v;
        int ret;
 
        bool v;
        int ret;
 
-       /* Match bool exactly, by re-using it. */
-       boolkp = *kp;
        boolkp.arg = &v;
 
        ret = param_set_bool(val, &boolkp);
        boolkp.arg = &v;
 
        ret = param_set_bool(val, &boolkp);
@@ -480,9 +479,8 @@ static int param_array_get(char *buffer, const struct kernel_param *kp)
 {
        int i, off, ret;
        const struct kparam_array *arr = kp->arr;
 {
        int i, off, ret;
        const struct kparam_array *arr = kp->arr;
-       struct kernel_param p;
+       struct kernel_param p = *kp;
 
 
-       p = *kp;
        for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {
                if (i)
                        buffer[off++] = ',';
        for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {
                if (i)
                        buffer[off++] = ',';