From b5459dd3541e76a46d3c49b480742ded05c429fd Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 29 Nov 2022 18:56:16 +0100 Subject: [PATCH] Fix the last two CFI callback prototype mismatches There was the series from me a year ago which fixed most of the callback vs implementation prototype mismatches. It was based on running the CFI-enabled kernel (in permissive mode -- warning instead of panic) and performing a full ZTS cycle, and then fixing all of the problems caught by CFI. Now, Clang 16-dev has new warning flag, -Wcast-function-type-strict, which detect such mismatches at compile-time. It allows to find the remaining issues missed by the first series. There are only two of them left: one for the secpolicy_vnode_setattr() callback and one for taskq_dispatch(). The fix is easy, since they are not used anywhere else. Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Lobakin Closes #14207 --- include/sys/zfs_acl.h | 2 +- module/os/freebsd/zfs/zfs_acl.c | 2 +- module/os/linux/zfs/zfs_acl.c | 2 +- module/os/linux/zfs/zfs_vnops_os.c | 2 +- module/zfs/txg.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/sys/zfs_acl.h b/include/sys/zfs_acl.h index 82fb98c9fb..e5c570c474 100644 --- a/include/sys/zfs_acl.h +++ b/include/sys/zfs_acl.h @@ -219,7 +219,7 @@ extern int zfs_zaccess(struct znode *, int, int, boolean_t, cred_t *, zuserns_t *); int zfs_fastaccesschk_execute(struct znode *, cred_t *); extern int zfs_zaccess_rwx(struct znode *, mode_t, int, cred_t *, zuserns_t *); -extern int zfs_zaccess_unix(struct znode *, mode_t, cred_t *); +extern int zfs_zaccess_unix(void *, int, cred_t *); extern int zfs_acl_access(struct znode *, int, cred_t *); int zfs_acl_chmod_setattr(struct znode *, zfs_acl_t **, uint64_t); int zfs_zaccess_delete(struct znode *, struct znode *, cred_t *, zuserns_t *); diff --git a/module/os/freebsd/zfs/zfs_acl.c b/module/os/freebsd/zfs/zfs_acl.c index 16bcd338de..64906b3bad 100644 --- a/module/os/freebsd/zfs/zfs_acl.c +++ b/module/os/freebsd/zfs/zfs_acl.c @@ -2483,7 +2483,7 @@ zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr, * Access function for secpolicy_vnode_setattr */ int -zfs_zaccess_unix(znode_t *zp, mode_t mode, cred_t *cr) +zfs_zaccess_unix(void *zp, int mode, cred_t *cr) { int v4_mode = zfs_unix_to_v4(mode >> 6); diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index 7d14863c56..89bfa02af7 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -2788,7 +2788,7 @@ zfs_zaccess_rwx(znode_t *zp, mode_t mode, int flags, cred_t *cr, * Access function for secpolicy_vnode_setattr */ int -zfs_zaccess_unix(znode_t *zp, mode_t mode, cred_t *cr) +zfs_zaccess_unix(void *zp, int mode, cred_t *cr) { int v4_mode = zfs_unix_to_v4(mode >> 6); diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c index 29d62837a8..94ae5e91f1 100644 --- a/module/os/linux/zfs/zfs_vnops_os.c +++ b/module/os/linux/zfs/zfs_vnops_os.c @@ -2186,7 +2186,7 @@ top: vap->va_mask &= ~trim_mask; } err = secpolicy_vnode_setattr(cr, ip, vap, &oldva, flags, - (int (*)(void *, int, cred_t *))zfs_zaccess_unix, zp); + zfs_zaccess_unix, zp); if (err) goto out3; diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 29eb9e8e80..ec61cabcaa 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -429,7 +429,7 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg) } static void -txg_do_callbacks(list_t *cb_list) +txg_do_callbacks(void *cb_list) { dmu_tx_do_callbacks(cb_list, 0); @@ -479,7 +479,7 @@ txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg) list_move_tail(cb_list, &tc->tc_callbacks[g]); - (void) taskq_dispatch(tx->tx_commit_cb_taskq, (task_func_t *) + (void) taskq_dispatch(tx->tx_commit_cb_taskq, txg_do_callbacks, cb_list, TQ_SLEEP); } }