Module Name: src Committed By: christos Date: Wed Oct 16 15:27:39 UTC 2019
Modified Files: src/sys/kern: kern_core.c kern_hook.c kern_sig.c kern_veriexec.c subr_ipi.c subr_pool.c subr_vmem.c sys_ptrace_common.c src/sys/net: if_ethersubr.c Log Message: Add void * function pointer casts. There are different ways to "fix" those warnings: 1. this one: add a void * cast (which I think is the least intrusive) 2. add pragmas to elide the warning 3. add intermediate inline conversion functions 4. change the called function prototypes, adding unused arguments and converting some of the pointer arguments to void *. 5. make the functions varyadic (which defeats the purpose of checking) 6. pass command line flags to elide the warning I did try 3 and 4 and I was not pleased with the result (sys_ptrace_common.c) (3) added too much code and defines, and (4) made the regular use clumsy. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/kern/kern_core.c cvs rdiff -u -r1.6 -r1.7 src/sys/kern/kern_hook.c cvs rdiff -u -r1.373 -r1.374 src/sys/kern/kern_sig.c cvs rdiff -u -r1.20 -r1.21 src/sys/kern/kern_veriexec.c cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_ipi.c cvs rdiff -u -r1.259 -r1.260 src/sys/kern/subr_pool.c cvs rdiff -u -r1.97 -r1.98 src/sys/kern/subr_vmem.c cvs rdiff -u -r1.67 -r1.68 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.278 -r1.279 src/sys/net/if_ethersubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_core.c diff -u src/sys/kern/kern_core.c:1.24 src/sys/kern/kern_core.c:1.25 --- src/sys/kern/kern_core.c:1.24 Thu Jul 7 02:55:43 2016 +++ src/sys/kern/kern_core.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_core.c,v 1.24 2016/07/07 06:55:43 msaitoh Exp $ */ +/* $NetBSD: kern_core.c,v 1.25 2019/10/16 15:27:38 christos Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.24 2016/07/07 06:55:43 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_core.c,v 1.25 2019/10/16 15:27:38 christos Exp $"); #include <sys/param.h> #include <sys/vnode.h> @@ -78,7 +78,7 @@ coredump_modcmd(modcmd_t cmd, void *arg) * no references, and so can be unloaded, no user programs * can be running and so nothing can call *coredump_vec. */ - coredump_vec = (int (*)(struct lwp *, const char *))enosys; + coredump_vec = (int (*)(struct lwp *, const char *))(void *)enosys; return 0; default: return ENOTTY; Index: src/sys/kern/kern_hook.c diff -u src/sys/kern/kern_hook.c:1.6 src/sys/kern/kern_hook.c:1.7 --- src/sys/kern/kern_hook.c:1.6 Fri Nov 22 16:04:11 2013 +++ src/sys/kern/kern_hook.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_hook.c,v 1.6 2013/11/22 21:04:11 christos Exp $ */ +/* $NetBSD: kern_hook.c,v 1.7 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.6 2013/11/22 21:04:11 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.7 2019/10/16 15:27:38 christos Exp $"); #include <sys/param.h> #include <sys/malloc.h> @@ -102,7 +102,7 @@ hook_proc_run(hook_list_t *list, struct struct hook_desc *hd; LIST_FOREACH(hd, list, hk_list) - ((void (*)(struct proc *, void *))*hd->hk_fn)(p, hd->hk_arg); + ((void (*)(struct proc *, void *))(void *)*hd->hk_fn)(p, hd->hk_arg); } /* @@ -201,7 +201,7 @@ static hook_list_t exechook_list = LIST_ void * exechook_establish(void (*fn)(struct proc *, void *), void *arg) { - return hook_establish(&exechook_list, (void (*)(void *))fn, arg); + return hook_establish(&exechook_list, (void (*)(void *))(void *)fn, arg); } void @@ -228,7 +228,7 @@ exithook_establish(void (*fn)(struct pro void *rv; rw_enter(&exec_lock, RW_WRITER); - rv = hook_establish(&exithook_list, (void (*)(void *))fn, arg); + rv = hook_establish(&exithook_list, (void (*)(void *))(void *)fn, arg); rw_exit(&exec_lock); return rv; } @@ -256,7 +256,7 @@ static hook_list_t forkhook_list = LIST_ void * forkhook_establish(void (*fn)(struct proc *, struct proc *)) { - return hook_establish(&forkhook_list, (void (*)(void *))fn, NULL); + return hook_establish(&forkhook_list, (void (*)(void *))(void *)fn, NULL); } void @@ -274,7 +274,7 @@ doforkhooks(struct proc *p2, struct proc struct hook_desc *hd; LIST_FOREACH(hd, &forkhook_list, hk_list) { - ((void (*)(struct proc *, struct proc *))*hd->hk_fn) + ((void (*)(struct proc *, struct proc *))(void *)*hd->hk_fn) (p2, p1); } } Index: src/sys/kern/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.373 src/sys/kern/kern_sig.c:1.374 --- src/sys/kern/kern_sig.c:1.373 Tue Oct 15 09:59:57 2019 +++ src/sys/kern/kern_sig.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.373 2019/10/15 13:59:57 kamil Exp $ */ +/* $NetBSD: kern_sig.c,v 1.374 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.373 2019/10/15 13:59:57 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.374 2019/10/16 15:27:38 christos Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -133,7 +133,7 @@ static void *sigacts_poolpage_alloc(stru void (*sendsig_sigcontext_vec)(const struct ksiginfo *, const sigset_t *); int (*coredump_vec)(struct lwp *, const char *) = - (int (*)(struct lwp *, const char *))enosys; + (int (*)(struct lwp *, const char *))(void *)enosys; /* * DTrace SDT provider definitions Index: src/sys/kern/kern_veriexec.c diff -u src/sys/kern/kern_veriexec.c:1.20 src/sys/kern/kern_veriexec.c:1.21 --- src/sys/kern/kern_veriexec.c:1.20 Sun Apr 28 17:36:19 2019 +++ src/sys/kern/kern_veriexec.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_veriexec.c,v 1.20 2019/04/28 21:36:19 alnsn Exp $ */ +/* $NetBSD: kern_veriexec.c,v 1.21 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c) 2005, 2006 Elad Efrat <e...@netbsd.org> @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.20 2019/04/28 21:36:19 alnsn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_veriexec.c,v 1.21 2019/10/16 15:27:38 christos Exp $"); #include "opt_veriexec.h" @@ -351,8 +351,8 @@ veriexec_init(void) rw_init(&veriexec_op_lock); #define FPOPS_ADD(a, b, c, d, e, f) \ - veriexec_fpops_add(a, b, c, (veriexec_fpop_init_t)d, \ - (veriexec_fpop_update_t)e, (veriexec_fpop_final_t)f) + veriexec_fpops_add(a, b, c, (veriexec_fpop_init_t)(void *)d, \ + (veriexec_fpop_update_t)(void *)e, (veriexec_fpop_final_t)(void *)f) #ifdef VERIFIED_EXEC_FP_SHA256 FPOPS_ADD("SHA256", SHA256_DIGEST_LENGTH, sizeof(SHA256_CTX), Index: src/sys/kern/subr_ipi.c diff -u src/sys/kern/subr_ipi.c:1.5 src/sys/kern/subr_ipi.c:1.6 --- src/sys/kern/subr_ipi.c:1.5 Thu Sep 5 05:20:05 2019 +++ src/sys/kern/subr_ipi.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_ipi.c,v 1.5 2019/09/05 09:20:05 ryo Exp $ */ +/* $NetBSD: subr_ipi.c,v 1.6 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.5 2019/09/05 09:20:05 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_ipi.c,v 1.6 2019/10/16 15:27:38 christos Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -150,7 +150,7 @@ ipi_register(ipi_func_t func, void *arg) void ipi_unregister(u_int ipi_id) { - ipi_msg_t ipimsg = { .func = (ipi_func_t)nullop }; + ipi_msg_t ipimsg = { .func = (ipi_func_t)(void *)nullop }; KASSERT(ipi_id != IPI_SYNCH_ID); KASSERT(ipi_id < IPI_MAXREG); Index: src/sys/kern/subr_pool.c diff -u src/sys/kern/subr_pool.c:1.259 src/sys/kern/subr_pool.c:1.260 --- src/sys/kern/subr_pool.c:1.259 Mon Sep 23 01:39:59 2019 +++ src/sys/kern/subr_pool.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_pool.c,v 1.259 2019/09/23 05:39:59 skrll Exp $ */ +/* $NetBSD: subr_pool.c,v 1.260 2019/10/16 15:27:38 christos Exp $ */ /* * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018 @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.259 2019/09/23 05:39:59 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.260 2019/10/16 15:27:38 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -2063,10 +2063,10 @@ pool_cache_bootstrap(pool_cache_t pc, si mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl); if (ctor == NULL) { - ctor = (int (*)(void *, void *, int))nullop; + ctor = (int (*)(void *, void *, int))(void *)nullop; } if (dtor == NULL) { - dtor = (void (*)(void *, void *))nullop; + dtor = (void (*)(void *, void *))(void *)nullop; } pc->pc_emptygroups = NULL; @@ -2339,7 +2339,7 @@ pool_cache_invalidate(pool_cache_t pc) * cache back to the global pool then wait for the xcall to * complete. */ - where = xc_broadcast(0, (xcfunc_t)pool_cache_transfer, + where = xc_broadcast(0, (xcfunc_t)(void *)pool_cache_transfer, pc, NULL); xc_wait(where); } Index: src/sys/kern/subr_vmem.c diff -u src/sys/kern/subr_vmem.c:1.97 src/sys/kern/subr_vmem.c:1.98 --- src/sys/kern/subr_vmem.c:1.97 Thu Feb 8 04:05:20 2018 +++ src/sys/kern/subr_vmem.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_vmem.c,v 1.97 2018/02/08 09:05:20 dholland Exp $ */ +/* $NetBSD: subr_vmem.c,v 1.98 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.97 2018/02/08 09:05:20 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.98 2019/10/16 15:27:38 christos Exp $"); #if defined(_KERNEL) && defined(_KERNEL_OPT) #include "opt_ddb.h" @@ -769,8 +769,8 @@ vmem_import(vmem_t *vm, vmem_size_t size } if (vm->vm_flags & VM_XIMPORT) { - rc = ((vmem_ximport_t *)vm->vm_importfn)(vm->vm_arg, size, - &size, flags, &addr); + rc = ((vmem_ximport_t *)(void *)vm->vm_importfn)(vm->vm_arg, + size, &size, flags, &addr); } else { rc = (vm->vm_importfn)(vm->vm_arg, size, flags, &addr); } @@ -1005,7 +1005,7 @@ vmem_xcreate(const char *name, vmem_addr KASSERT((flags & (VM_XIMPORT)) == 0); return vmem_init(NULL, name, base, size, quantum, - (vmem_import_t *)importfn, releasefn, source, + (vmem_import_t *)(void *)importfn, releasefn, source, qcache_max, flags | VM_XIMPORT, ipl); } Index: src/sys/kern/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.67 src/sys/kern/sys_ptrace_common.c:1.68 --- src/sys/kern/sys_ptrace_common.c:1.67 Sat Oct 12 08:04:37 2019 +++ src/sys/kern/sys_ptrace_common.c Wed Oct 16 11:27:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.67 2019/10/12 12:04:37 kamil Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.68 2019/10/16 15:27:38 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.67 2019/10/12 12:04:37 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.68 2019/10/16 15:27:38 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -1505,14 +1505,14 @@ process_doregs(struct lwp *curl /*tracer return EINVAL; } s = sizeof(process_reg32); - r = (regrfunc_t)process_read_regs32; - w = (regwfunc_t)process_write_regs32; + r = (regrfunc_t)(void *)process_read_regs32; + w = (regwfunc_t)(void *)process_write_regs32; } else #endif { s = sizeof(struct reg); - r = (regrfunc_t)process_read_regs; - w = (regwfunc_t)process_write_regs; + r = (regrfunc_t)(void *)process_read_regs; + w = (regwfunc_t)(void *)process_write_regs; } return proc_regio(l, uio, s, r, w); #else Index: src/sys/net/if_ethersubr.c diff -u src/sys/net/if_ethersubr.c:1.278 src/sys/net/if_ethersubr.c:1.279 --- src/sys/net/if_ethersubr.c:1.278 Wed Oct 2 00:17:16 2019 +++ src/sys/net/if_ethersubr.c Wed Oct 16 11:27:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ethersubr.c,v 1.278 2019/10/02 04:17:16 msaitoh Exp $ */ +/* $NetBSD: if_ethersubr.c,v 1.279 2019/10/16 15:27:39 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.278 2019/10/02 04:17:16 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.279 2019/10/16 15:27:39 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1035,7 +1035,7 @@ ether_ifdetach(struct ifnet *ifp) * is in the process of being detached. Return device not configured * instead. */ - ifp->if_ioctl = (int (*)(struct ifnet *, u_long, void *))enxio; + ifp->if_ioctl = (int (*)(struct ifnet *, u_long, void *))(void *)enxio; #if NBRIDGE > 0 if (ifp->if_bridge)