[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241019092357.212439-1-yuehaibing@huawei.com>
Date: Sat, 19 Oct 2024 17:23:57 +0800
From: Yue Haibing <yuehaibing@...wei.com>
To: <clm@...com>, <josef@...icpanda.com>, <dsterba@...e.com>,
<mpdesouza@...e.com>, <gniebler@...e.com>
CC: <linux-btrfs@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<yuehaibing@...wei.com>
Subject: [PATCH] btrfs: Fix passing 0 to ERR_PTR in btrfs_search_dir_index_item()
Return NULL instead of passing to ERR_PTR while ret is zero, this fix
smatch warnings:
fs/btrfs/dir-item.c:353
btrfs_search_dir_index_item() warn: passing zero to 'ERR_PTR'
Fixes: 9dcbe16fccbb ("btrfs: use btrfs_for_each_slot in btrfs_search_dir_index_item")
Signed-off-by: Yue Haibing <yuehaibing@...wei.com>
---
fs/btrfs/dir-item.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 001c0c2f872c..cdb30ec7366a 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -350,7 +350,7 @@ btrfs_search_dir_index_item(struct btrfs_root *root, struct btrfs_path *path,
if (ret > 0)
ret = 0;
- return ERR_PTR(ret);
+ return ret ? ERR_PTR(ret) : NULL;
}
struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
--
2.34.1
Powered by blists - more mailing lists