History

kernel/module.c: use generic module param operaters for sig_enforce

We're directly checking and modifying sig_enforce when needed instead of using the generic helpers. This prevents us from generalizing this helper so that others can use it. Use indirect helpers to allow us to generalize this code a bit and to make it a bit more clear what this is doing.

Luis R. Rodriguez committed 11 years ago

Commit 05f408d1 parent 9c278471 file · +9 −7Browse files

Unified · Split

kernel/module.c+9−7
@@ -301,23 +301,25 @@ static bool sig_enforce = false; · 300 unmodified lines
301301 static int param_set_bool_enable_only(const char *val,
302302 const struct kernel_param *kp)
303303 {
304− int err;
305− bool test;
304+ int err = 0;
305+ bool new_value;
306+ bool orig_value = *(bool *)kp->arg;
306307 struct kernel_param dummy_kp = *kp;
307308
308− dummy_kp.arg = &test;
309+ dummy_kp.arg = &new_value;
309310
310311 err = param_set_bool(val, &dummy_kp);
311312 if (err)
312313 return err;
313314
314315 /* Don't let them unset it once it's set! */
315− if (!test && sig_enforce)
316+ if (!new_value && orig_value)
316317 return -EROFS;
317318
318− if (test)
319− sig_enforce = true;
320− return 0;
319+ if (new_value)
320+ err = param_set_bool(val, kp);
321+
322+ return err;
321323 }
322324
323325 static const struct kernel_param_ops param_ops_bool_enable_only = {