treewide: Fix function prototypes for module_param_call()
Several function prototypes for the set/get functions defined by
module_param_call() have a slightly wrong argument types. This fixes
those in an effort to clean up the calls when running under type-enforced
compiler instrumentation for CFI. This is the result of running the
following semantic patch:
@match_module_param_call_function@
declarer name module_param_call;
identifier _name, _set_func, _get_func;
expression _arg, _mode;
@@
module_param_call(_name, _set_func, _get_func, _arg, _mode);
@fix_set_prototype
depends on match_module_param_call_function@
identifier match_module_param_call_function._set_func;
identifier _val, _param;
type _val_type, _param_type;
@@
int _set_func(
-_val_type _val
+const char * _val
,
-_param_type _param
+const struct kernel_param * _param
) { ... }
@fix_get_prototype
depends on match_module_param_call_function@
identifier match_module_param_call_function._get_func;
identifier _val, _param;
type _val_type, _param_type;
@@
int _get_func(
-_val_type _val
+char * _val
,
-_param_type _param
+const struct kernel_param * _param
) { ... }
Two additional by-hand changes are included for places where the above
Coccinelle script didn't notice them:
drivers/platform/x86/thinkpad_acpi.c
fs/lockd/svc.c
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
This commit is contained in:
@@ -99,7 +99,7 @@ module_param(mpt_channel_mapping, int, 0);
|
||||
MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
|
||||
|
||||
static int mpt_debug_level;
|
||||
static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
|
||||
static int mpt_set_debug_level(const char *val, const struct kernel_param *kp);
|
||||
module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
|
||||
&mpt_debug_level, 0600);
|
||||
MODULE_PARM_DESC(mpt_debug_level,
|
||||
@@ -242,7 +242,7 @@ pci_enable_io_access(struct pci_dev *pdev)
|
||||
pci_write_config_word(pdev, PCI_COMMAND, command_reg);
|
||||
}
|
||||
|
||||
static int mpt_set_debug_level(const char *val, struct kernel_param *kp)
|
||||
static int mpt_set_debug_level(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
int ret = param_set_int(val, kp);
|
||||
MPT_ADAPTER *ioc;
|
||||
|
||||
Reference in New Issue
Block a user