Re: [PATCH v2 2/2] ext2: ext2_find_entry() return -ENOENT if no entry found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020/6/5 23:11, Jan Kara wrote:
> 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@xxxxxxxxxx>
>> Suggested-by: Jan Kara <jack@xxxxxxx>
> 
> 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...
> 
Indeed, I missed this point, will do.

Thanks,
Yi.




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux