summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@suse.com>2015-05-27 11:09:38 +0930
committerRusty Russell <rusty@rustcorp.com.au>2015-05-28 11:32:11 +0930
commitd19f05d8a8fa221e5d5f4eaca0f3ca5874c990d3 (patch)
treeaf7ed11bef82faa0e7a33b6ec8739a32ec50f00f /kernel/module.c
parent05f408dddb013168759cdb4cbd0ba4e189a9504d (diff)
downloadlwn-d19f05d8a8fa221e5d5f4eaca0f3ca5874c990d3.tar.gz
lwn-d19f05d8a8fa221e5d5f4eaca0f3ca5874c990d3.zip
kernel/params.c: generalize bool_enable_only
This takes out the bool_enable_only implementation from the module loading code and generalizes it so that others can make use of it. Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Kees Cook <keescook@chromium.org> Cc: Tejun Heo <tj@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: linux-kernel@vger.kernel.org Cc: cocci@systeme.lip6.fr Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 9e8c9305bba9..9b0e36145474 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -298,37 +298,6 @@ static bool sig_enforce = true;
#else
static bool sig_enforce = false;
-static int param_set_bool_enable_only(const char *val,
- const struct kernel_param *kp)
-{
- int err = 0;
- bool new_value;
- bool orig_value = *(bool *)kp->arg;
- struct kernel_param dummy_kp = *kp;
-
- dummy_kp.arg = &new_value;
-
- err = param_set_bool(val, &dummy_kp);
- if (err)
- return err;
-
- /* Don't let them unset it once it's set! */
- if (!new_value && orig_value)
- return -EROFS;
-
- if (new_value)
- err = param_set_bool(val, kp);
-
- return err;
-}
-
-static const struct kernel_param_ops param_ops_bool_enable_only = {
- .flags = KERNEL_PARAM_OPS_FL_NOARG,
- .set = param_set_bool_enable_only,
- .get = param_get_bool,
-};
-#define param_check_bool_enable_only param_check_bool
-
module_param(sig_enforce, bool_enable_only, 0644);
#endif /* !CONFIG_MODULE_SIG_FORCE */
#endif /* CONFIG_MODULE_SIG */