From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A475FC2BB9A for ; Thu, 10 Dec 2020 16:31:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D5F823DB4 for ; Thu, 10 Dec 2020 16:31:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392210AbgLJQFE (ORCPT ); Thu, 10 Dec 2020 11:05:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:51824 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391491AbgLJQFD (ORCPT ); Thu, 10 Dec 2020 11:05:03 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6FCE3AF22; Thu, 10 Dec 2020 16:04:20 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id EFC9C1E1354; Thu, 10 Dec 2020 17:04:19 +0100 (CET) Date: Thu, 10 Dec 2020 17:04:19 +0100 From: Jan Kara To: Dan Carpenter Cc: Theodore Ts'o , Harshad Shirwadkar , Andreas Dilger , linux-ext4@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] ext4: Fix an IS_ERR() vs NULL check Message-ID: <20201210160419.GA31725@quack2.suse.cz> References: <20201023112232.GB282278@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201023112232.GB282278@mwanda> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 23-10-20 14:22:32, Dan Carpenter wrote: > The ext4_find_extent() function never returns NULL, it returns error > pointers. > > Fixes: 44059e503b03 ("ext4: fast commit recovery path") > Signed-off-by: Dan Carpenter I think this fix has fallen through the cracks? It looks good to me so feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/extents.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index 6b33b9c86b00..a19d0e3a4126 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -5820,8 +5820,8 @@ int ext4_ext_replay_update_ex(struct inode *inode, ext4_lblk_t start, > int ret; > > path = ext4_find_extent(inode, start, NULL, 0); > - if (!path) > - return -EINVAL; > + if (IS_ERR(path)) > + return PTR_ERR(path); > ex = path[path->p_depth].p_ext; > if (!ex) { > ret = -EFSCORRUPTED; > -- > 2.28.0 > -- Jan Kara SUSE Labs, CR