From 66a38fd10ac5dd8734c9a024e8cb5745436e6f62 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sun, 5 Mar 2023 01:32:03 -0500 Subject: [PATCH] Linux: Suppress clang static analyzer warning in zfs_remove() Clang's static analyzer points out that if we fail to find an extended attribute directory, but somehow find it when calculating delete_now and delete_now is true, we will have a NULL pointer dereference when we try to unlink the extended attribute directory. I am not sure if this is possible, but if it is, I do not see a sane way of handling this other than rolling back the transaction and retrying. For now, let us do an VERIFY_IMPLY(). If this trips, it will stop the transaction from committing, which will prevent an attribute directory leak. Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #14575 --- module/os/linux/zfs/zfs_vnops_os.c | 1 + 1 file changed, 1 insertion(+) diff --git a/module/os/linux/zfs/zfs_vnops_os.c b/module/os/linux/zfs/zfs_vnops_os.c index f7979a008f..b8af3e3b05 100644 --- a/module/os/linux/zfs/zfs_vnops_os.c +++ b/module/os/linux/zfs/zfs_vnops_os.c @@ -1089,6 +1089,7 @@ top: !zn_has_cached_data(zp, 0, LLONG_MAX) && xattr_obj == xattr_obj_unlinked && zfs_external_acl(zp) == acl_obj; + VERIFY_IMPLY(xattr_obj_unlinked, xzp); } if (delete_now) {