[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200605151100.GD13248@quack2.suse.cz>
Date: Fri, 5 Jun 2020 17:11:00 +0200
From: Jan Kara <jack@...e.cz>
To: "zhangyi (F)" <yi.zhang@...wei.com>
Cc: linux-ext4@...r.kernel.org, jack@...e.cz
Subject: Re: [PATCH v2 2/2] ext2: ext2_find_entry() return -ENOENT if no
entry found
On Wed 03-06-20 14:35:14, zhangyi (F) wrote:
> 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().
>
> Signed-off-by: zhangyi (F) <yi.zhang@...wei.com>
> Suggested-by: Jan Kara <jack@...e.cz>
Thanks for the patch. Just one small nit below.
> @@ -419,11 +419,16 @@ 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);
> ext2_put_page(page);
> + if (!de->inode) {
ext2_find_entry() will not ever return de with de->inode == 0 because
ext2_match() never returns true for such entries. So I'd just remove this
condition...
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists