Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+2 -8
+2 -8
include/linux/moduleparam.h
··· 350 350 extern int param_get_charp(char *buffer, const struct kernel_param *kp); 351 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 354 extern struct kernel_param_ops param_ops_bool; 355 355 extern int param_set_bool(const char *val, const struct kernel_param *kp); 356 356 extern int param_get_bool(char *buffer, const struct kernel_param *kp); 357 - #define param_check_bool(name, p) \ 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 - } 357 + #define param_check_bool(name, p) __param_check(name, p, bool) 364 358 365 359 extern struct kernel_param_ops param_ops_invbool; 366 360 extern int param_set_invbool(const char *val, const struct kernel_param *kp);