UPSTREAM: treewide: Fix function prototypes for module_param_call()
authorKees Cook <keescook@chromium.org>
Wed, 18 Oct 2017 02:04:42 +0000 (19:04 -0700)
committerSami Tolvanen <samitolvanen@google.com>
Wed, 25 Apr 2018 23:04:04 +0000 (16:04 -0700)
commit549b203743145b290c31f1d349f06e43e7cf06ee
tree69a2b78e2e3fea7f7de30ec0f69b43c82523a814
parent5b37dfe508f9d710946524faa1bcfab228e8c100
UPSTREAM: 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>
Bug: 67506682
Change-Id: I2c9c0ee8ed28065e63270a52c155e5e7d2791295
(cherry picked from commit e4dca7b7aa08b22893c45485d222b5807c1375ae)
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
42 files changed:
arch/powerpc/platforms/pseries/cmm.c
arch/x86/oprofile/nmi_int.c
drivers/acpi/button.c
drivers/acpi/ec.c
drivers/acpi/sysfs.c
drivers/android/binder.c
drivers/char/ipmi/ipmi_poweroff.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/edac/edac_mc_sysfs.c
drivers/edac/edac_module.c
drivers/hid/hid-magicmouse.c
drivers/ide/ide.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/ulp/srpt/ib_srpt.c
drivers/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/mISDNinfineon.c
drivers/isdn/hardware/mISDN/netjet.c
drivers/isdn/hardware/mISDN/speedfax.c
drivers/isdn/hardware/mISDN/w6692.c
drivers/md/md.c
drivers/media/pci/tw686x/tw686x-core.c
drivers/media/usb/uvc/uvc_driver.c
drivers/message/fusion/mptbase.c
drivers/misc/kgdbts.c
drivers/mtd/devices/block2mtd.c
drivers/mtd/devices/phram.c
drivers/mtd/ubi/build.c
drivers/pci/pcie/aspm.c
drivers/platform/x86/thinkpad_acpi.c
drivers/scsi/fcoe/fcoe_transport.c
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/mpt3sas/mpt3sas_scsih.c
drivers/tty/serial/kgdboc.c
fs/fuse/inode.c
fs/lockd/svc.c
fs/ocfs2/dlmfs/dlmfs.c
include/net/netfilter/nf_conntrack.h
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_nat_ftp.c
net/netfilter/nf_nat_irc.c
net/sunrpc/svc.c
security/apparmor/lsm.c