diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-01-12 18:02:28 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-01-12 18:02:28 -0500 |
commit | 72db395ffadb1d33233fd123c2bf87ba0198c6c1 (patch) | |
tree | 797832ee187297bb01cbad849b614c0caaac39ed /include/linux/moduleparam.h | |
parent | a6e02554c1036f8c62080ecf4702703427c651a4 (diff) |
module_param: check that bool parameters really are bool.
module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.
This tightens the check (you'll get a warning about incompatible
return type) but still allows it. Next kernel version, we'll remove
it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/moduleparam.h')
-rw-r--r-- | include/linux/moduleparam.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 6bdde0c3bcca..c47f4d60db0b 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -350,17 +350,11 @@ extern int param_set_charp(const char *val, const struct kernel_param *kp); | |||
350 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); | 350 | extern int param_get_charp(char *buffer, const struct kernel_param *kp); |
351 | #define param_check_charp(name, p) __param_check(name, p, char *) | 351 | #define param_check_charp(name, p) __param_check(name, p, char *) |
352 | 352 | ||
353 | /* For historical reasons "bool" parameters can be (unsigned) "int". */ | 353 | /* We used to allow int as well as bool. We're taking that away! */ |
354 | extern struct kernel_param_ops param_ops_bool; | 354 | extern struct kernel_param_ops param_ops_bool; |
355 | extern int param_set_bool(const char *val, const struct kernel_param *kp); | 355 | extern int param_set_bool(const char *val, const struct kernel_param *kp); |
356 | extern int param_get_bool(char *buffer, const struct kernel_param *kp); | 356 | extern int param_get_bool(char *buffer, const struct kernel_param *kp); |
357 | #define param_check_bool(name, p) \ | 357 | #define param_check_bool(name, p) __param_check(name, p, bool) |
358 | static inline void __check_##name(void) \ | ||
359 | { \ | ||
360 | BUILD_BUG_ON(!__same_type((p), bool *) && \ | ||
361 | !__same_type((p), unsigned int *) && \ | ||
362 | !__same_type((p), int *)); \ | ||
363 | } | ||
364 | 358 | ||
365 | extern struct kernel_param_ops param_ops_invbool; | 359 | extern struct kernel_param_ops param_ops_invbool; |
366 | extern int param_set_invbool(const char *val, const struct kernel_param *kp); | 360 | extern int param_set_invbool(const char *val, const struct kernel_param *kp); |