From: Richard Yao Date: Mon, 5 Dec 2022 18:16:50 +0000 (-0500) Subject: FreeBSD: zfs_register_callbacks() must implement error check correctly X-Git-Tag: zfs-2.1.8~22 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=572114d8465bb928dec51b7668e6627df255b1d1;p=mirror_zfs.git FreeBSD: zfs_register_callbacks() must implement error check correctly I read the following article and noticed a couple of ZFS bugs mentioned: https://pvs-studio.com/en/blog/posts/cpp/0377/ I decided to search for them in the modern OpenZFS codebase and then found one that matched the description of the first one: V593 Consider reviewing the expression of the 'A = B != C' kind. The expression is calculated as following: 'A = (B != C)'. zfs_vfsops.c 498 The consequence of this is that the error value is replaced with `1` when there is an error. When there is no error, 0 is correctly passed. This is a very minor issue that is unlikely to cause any real problems. The incorrect error code would either be returned to the mount command on a failure or any of `zfs receive`, `zfs recv`, `zfs rollback` or `zfs upgrade`. The second one has already been fixed. Reviewed-by: Alexander Motin Reviewed-by: Damian Szuberski Signed-off-by: Richard Yao Closes #14261 --- diff --git a/module/os/freebsd/zfs/zfs_vfsops.c b/module/os/freebsd/zfs/zfs_vfsops.c index 05d41d4e3..248b2d924 100644 --- a/module/os/freebsd/zfs/zfs_vfsops.c +++ b/module/os/freebsd/zfs/zfs_vfsops.c @@ -720,7 +720,7 @@ zfs_register_callbacks(vfs_t *vfsp) nbmand = B_FALSE; } else if (vfs_optionisset(vfsp, MNTOPT_NBMAND, NULL)) { nbmand = B_TRUE; - } else if ((error = dsl_prop_get_int_ds(ds, "nbmand", &nbmand) != 0)) { + } else if ((error = dsl_prop_get_int_ds(ds, "nbmand", &nbmand)) != 0) { dsl_pool_config_exit(dmu_objset_pool(os), FTAG); return (error); }