Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4442275pxj; Mon, 21 Jun 2021 23:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKxjqaDl2RoMe3uGXIOi/f4CGPu3WABqMu04yKIA+R4un8/5H3+4lof6p+mqXMuwF4Kqxw X-Received: by 2002:a92:cdab:: with SMTP id g11mr1658503ild.240.1624344337178; Mon, 21 Jun 2021 23:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624344337; cv=none; d=google.com; s=arc-20160816; b=dDlLxP0ShaZzzzWVI4V1aQbM10w55jxmOmB3k1Drfe6HHu7sSWW6jV4vjAjPdk2jRF XJqwjT4FFs9atmlcrqjpiootBXoJV0umUKt9fbQlnDKvIZsL7pBtlM/GNvUgh/R2Amr0 eYHTF+hPoO35P3B/xTqMQn32y3WJu7KYFlL/IE5ZkTWM9MDiPfM2hFILnT0i6q7pVsFE JjBUrORpQ6yJEl0UlFGBR8WvvMseYYVn2BmK4uomSt0DVPTs9hfEeWVzj8X4nHGJm8w5 HHXUwlR9Cv4oIooIxyztw2vX+sP5NkYZQO5T4Cy+ktcvDmgdGytbpvtmWrSjNxuOk5Dj PiWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QfXXLmm0iGyiQYiHgMzRvZ8iyquEj7HAHDtJoxfX+fE=; b=VBgWSZ7afxQlD80NmG3SbjJGA0dPEB6vViz+6BHtyx0ng/lIMtAvqY5wQJbfHGCmE6 05DtrBU6CtfodMH9sW4Kgu2fZ9aJcMDcBA1qyRo+RoPvxeHWh3+DyC+1E2LmxcSK8H+T 6nZrKLo9ghCHb8gWAr6KwxvxnnpDW5N4xuM6d/HJ8I9Vd66GYl/u968OIVJTO5ihRBXB R+r+V1PFzmdbueUi48KkdDXd429nvKrN4zUXN+bBqctn32miHUywjAdi92AsSMTI7nMk LPWu3L5MQftiiThY9+1i+Re5DaLRKnyafgBlP3olv7C0BgfNo+9Gm7q0E0tNd9rRwV9E HOug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=J6L4Iv1K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si14211554ilj.66.2021.06.21.23.45.24; Mon, 21 Jun 2021 23:45:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=J6L4Iv1K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229949AbhFVGrE (ORCPT + 99 others); Tue, 22 Jun 2021 02:47:04 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:22472 "EHLO mx0b-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbhFVGrD (ORCPT ); Tue, 22 Jun 2021 02:47:03 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M6gNOH011901; Tue, 22 Jun 2021 06:44:30 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : content-transfer-encoding : in-reply-to; s=corp-2020-01-29; bh=QfXXLmm0iGyiQYiHgMzRvZ8iyquEj7HAHDtJoxfX+fE=; b=J6L4Iv1KmxQMwPC3uMT6OeDHcgkCHWMp6PxSm+l2u774Oj0DE86KWaYyQ9n2PZnBBKqr t/1TRwjjsYicuqxUiASMSO0pLyTWHrHy3W5z7Qy8OHZBqPvPAa/u5QXlBVpyqEIo4+o5 iT3TxANspLHR6HhwPq5sqZfGQBIOj4SaZBLaBWCBBAINaGRl1yWuV6ibDCWl+sX+/PQb uadq4A8gxzpH0mQWOfX5jb8iLXzOT2Be2rvhuSpN5ZupEW9RYtT3mUskW8B197QhYN5u /fIyJpwknmttwdOi9kM7TVOC/syJ2xF7I6JST0u7cNUJ+9ARCWpjWWb3s1S29NGXMJ34 PA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 39acyqb2b6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 06:44:30 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15M6fBFq158054; Tue, 22 Jun 2021 06:44:29 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 3995pvqve1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 06:44:29 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 15M6iSkF171196; Tue, 22 Jun 2021 06:44:28 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 3995pvqvd9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 06:44:28 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 15M6iQn5019890; Tue, 22 Jun 2021 06:44:27 GMT Received: from kadam (/102.222.70.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Jun 2021 23:44:26 -0700 Date: Tue, 22 Jun 2021 09:44:19 +0300 From: Dan Carpenter To: Zhihao Cheng Cc: Colin King , Richard Weinberger , linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ubifs: Remove a redundant null check on pointer lp Message-ID: <20210622064419.GJ1901@kadam> References: <20210621152249.20901-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: RuCeNEEez0_8-eKl6Wh6Pcbbaac3s5p1 X-Proofpoint-ORIG-GUID: RuCeNEEez0_8-eKl6Wh6Pcbbaac3s5p1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 22, 2021 at 10:38:52AM +0800, Zhihao Cheng wrote: > 在 2021/6/21 23:22, Colin King 写道: > > From: Colin Ian King > > > > An earlier fix to replace an IS_ERR check on lp with a null check > > on lp didn't remove a following null check on lp. The second null > > check is redundant and can be removed. > > > > Addresses-Coverity: ("Logically dead code") > > Fixes: c770cd5190ba ("ubifs: fix an IS_ERR() vs NULL check") > > Signed-off-by: Colin Ian King > > --- > > fs/ubifs/gc.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c > > index 7cc22d7317ea..465beea52176 100644 > > --- a/fs/ubifs/gc.c > > +++ b/fs/ubifs/gc.c > > @@ -899,8 +899,6 @@ int ubifs_gc_start_commit(struct ubifs_info *c) > > err = -ENOMEM; > > goto out; > > } > Hi Colin, > I just found out about it today thanks to your patch. Commit c770cd5190ba > ("ubifs: fix an IS_ERR() vs NULL check") did import a new problem that > ubifs_gc_start_commit() may return -ENOMEM while syncing fs. > I guess ubifs_fast_find_frdi_idx() return NULL pointer is the termination > condition in while-loop, which means we cannot get a freeable index LEB in > ubifs_gc_start_commit(). Ugh... I'm so sorry. My patch was clearly wrong. I've tried before to add a Smatch check which warns about duplicative NULL checks, but I think this gives me a new idea to try. Hopefully, it will prevent this in the future. Yeah, and it's my check which needs to be deleted, not the other one. regards, dan carpenter