mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] btrfs: Fix passing 0 to ERR_PTR in btrfs_search_dir_index_item()
@ 2024-10-19  9:23 Yue Haibing
  2024-10-21  8:25 ` Johannes Thumshirn
  0 siblings, 1 reply; 6+ messages in thread
From: Yue Haibing @ 2024-10-19  9:23 UTC (permalink / raw)
  To: clm, josef, dsterba, mpdesouza, gniebler
  Cc: linux-btrfs, linux-kernel, yuehaibing

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@huawei.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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-22  7:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-19  9:23 [PATCH] btrfs: Fix passing 0 to ERR_PTR in btrfs_search_dir_index_item() Yue Haibing
2024-10-21  8:25 ` Johannes Thumshirn
2024-10-22  3:22   ` Yue Haibing
2024-10-22  6:37     ` Johannes Thumshirn
2024-10-22  6:53       ` Yue Haibing
2024-10-22  7:16         ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®