summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-06-16 16:47:52 -0400
committerRusty Russell <rusty@rustcorp.com.au>2015-06-23 01:57:37 -0400
commit5104b7d7678b0029417f6ac08243773a77259ac6 (patch)
treebf1a7a2703674d474db5618302cf8b5acf3f8adc
parent74c3dea355245c17ee407a3ce3ea34f55b40f2eb (diff)
module: make perm const
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)
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--kernel/params.c8
2 files changed, 4 insertions, 6 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7e0079936396..ab5031453807 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -68,7 +68,7 @@ enum {
68struct kernel_param { 68struct kernel_param {
69 const char *name; 69 const char *name;
70 const struct kernel_param_ops *ops; 70 const struct kernel_param_ops *ops;
71 u16 perm; 71 const u16 perm;
72 s8 level; 72 s8 level;
73 u8 flags; 73 u8 flags;
74 union { 74 union {
diff --git a/kernel/params.c b/kernel/params.c
index e906874da5fc..a8b09f6c87dc 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -395,12 +395,11 @@ EXPORT_SYMBOL(param_ops_invbool);
395 395
396int param_set_bint(const char *val, const struct kernel_param *kp) 396int param_set_bint(const char *val, const struct kernel_param *kp)
397{ 397{
398 struct kernel_param boolkp; 398 /* Match bool exactly, by re-using it. */
399 struct kernel_param boolkp = *kp;
399 bool v; 400 bool v;
400 int ret; 401 int ret;
401 402
402 /* Match bool exactly, by re-using it. */
403 boolkp = *kp;
404 boolkp.arg = &v; 403 boolkp.arg = &v;
405 404
406 ret = param_set_bool(val, &boolkp); 405 ret = param_set_bool(val, &boolkp);
@@ -480,9 +479,8 @@ static int param_array_get(char *buffer, const struct kernel_param *kp)
480{ 479{
481 int i, off, ret; 480 int i, off, ret;
482 const struct kparam_array *arr = kp->arr; 481 const struct kparam_array *arr = kp->arr;
483 struct kernel_param p; 482 struct kernel_param p = *kp;
484 483
485 p = *kp;
486 for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) { 484 for (i = off = 0; i < (arr->num ? *arr->num : arr->max); i++) {
487 if (i) 485 if (i)
488 buffer[off++] = ','; 486 buffer[off++] = ',';