Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2207466ybg; Fri, 5 Jun 2020 08:11:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2kkeAQyaAdiCo6xpA7S7y07gxGl9/MBPGsnQVP1HLDNtdmE9pICJ1SgJASA1YAHny/ZTO X-Received: by 2002:a17:906:d923:: with SMTP id rn3mr9317607ejb.261.1591369896737; Fri, 05 Jun 2020 08:11:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591369896; cv=none; d=google.com; s=arc-20160816; b=xPxE2SS1MzOrprUWw/XYrrthL+lm/O7FHSk71NvzaGK8LpiG4w5h5iFHV/oSSu6Ont Qlw5tl9C3jWA2fYDL7H/mD42jGXeXGSgthZlEodceqYMw35ATIusIdjD9ozw/noHhADq LEoryabMSTAWPhhI6FoOh1w7nFxRKCU1FibUXCogm5+Yu0H7XKlEk7KYgvOyB3gs73nV ha0Plccynf5bsMSorLZKjZ8M58G9sqKwZd6W8uMlCbZ3IekQSOoJ9pAL5Az/UVShVquK ia7sfh5JkcSBPSOVt2qqcZp0KxaszsfCpMzKyWPAxE1qTF4oZqan+L7KePJfQHMET9pA bHgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/pVfZXuyE6BUU6Bb9tBcVucjbAPZUFL9cTfqa/8FlcQ=; b=wwK1sk3XWIhOTlwj9AiWhkEbstLwd3+f/NLr7B8DViwzxg7QLx/qObWumk8mcRXeaR Z8uSxSlD1yVAAZN+H99A4leYJKXhg1FNffOdqMe2UTu0CeZs2XyD2UlW87cE70IN9UE2 7i+c1l+j1uabJOZWtpJIcIWkMnEf85FXWo/wCLxc8K1WTUl7sdj0exMQ5thClbUbS+SJ FdjP08MmZjaA2Gb9TP/HG9kHKKgWmhQ9eI3Dlk7O4LJB9GOYEZlq77eUZYOk50BOjBSN MtoPlJ4AGIjWxTKsvuPFKdaTIRl/PuoF8ClxZy4YnL42y3pek6/7oOovpVpxSywWIfk4 zXJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id uz26si363030ejb.577.2020.06.05.08.11.07; Fri, 05 Jun 2020 08:11:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728016AbgFEPLC (ORCPT + 99 others); Fri, 5 Jun 2020 11:11:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:50564 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgFEPLC (ORCPT ); Fri, 5 Jun 2020 11:11:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6D2B4AD35; Fri, 5 Jun 2020 15:11:04 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A29591E1281; Fri, 5 Jun 2020 17:11:00 +0200 (CEST) Date: Fri, 5 Jun 2020 17:11:00 +0200 From: Jan Kara To: "zhangyi (F)" Cc: linux-ext4@vger.kernel.org, jack@suse.cz Subject: Re: [PATCH v2 2/2] ext2: ext2_find_entry() return -ENOENT if no entry found Message-ID: <20200605151100.GD13248@quack2.suse.cz> References: <20200603063514.3904811-1-yi.zhang@huawei.com> <20200603063514.3904811-2-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200603063514.3904811-2-yi.zhang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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) > Suggested-by: Jan Kara 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 SUSE Labs, CR