From a43850a380ef56009ce721737b0c08984b663b99 Mon Sep 17 00:00:00 2001 From: "zhangyi (F)" Date: Mon, 8 Jun 2020 11:40:43 +0800 Subject: ext2: ext2_find_entry() return -ENOENT if no entry found Almost all callers of ext2_find_entry() transform NULL return value to -ENOENT, so just let ext2_find_entry() retuen -ENOENT instead of NULL if no valid entry found, and also switch to check the return value of ext2_inode_by_name() in ext2_lookup() and ext2_get_parent(). Link: https://lore.kernel.org/r/20200608034043.10451-2-yi.zhang@huawei.com Signed-off-by: zhangyi (F) Suggested-by: Jan Kara Signed-off-by: Jan Kara --- fs/ext2/dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/ext2/dir.c') diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 95e4f0bd55a3..70355ab6740e 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c @@ -393,7 +393,7 @@ struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir, } } while (n != start); out: - return NULL; + return ERR_PTR(-ENOENT); found: *res_page = page; @@ -419,7 +419,7 @@ int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino) struct page *page; de = ext2_find_entry(dir, child, &page); - if (IS_ERR_OR_NULL(de)) + if (IS_ERR(de)) return PTR_ERR(de); *ino = le32_to_cpu(de->inode); -- cgit v1.2.3