Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp31714iob; Thu, 12 May 2022 17:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDrUaJelVzHBcUypXY92BzX6MbdDMNAx7hebhD+8rf2VFlPkBOC+8U0SlmOcjxgp7qllIc X-Received: by 2002:a17:907:161f:b0:6f4:378a:c2d8 with SMTP id hb31-20020a170907161f00b006f4378ac2d8mr2172400ejc.289.1652402545199; Thu, 12 May 2022 17:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652402545; cv=none; d=google.com; s=arc-20160816; b=IKrrCyNdXqxvDMjU4JfWj0T78HFXzUCNRYebuodhM3nFN6ThFvONI32epbQHStggep pc7VoW3zW7j4Com2bNUsWX7OJoxw2zPJRnI7MQqewMPNVerGF2uvpUU8AlX00MJ7f8r2 gktWpXvn78UQ+HqoA1vZAzkB9w48gZTf9MAyeA4du7aoaQ/BfWN6xAQq0TEmB3Cc2d0J DXCjCzBgjXHy3yaJY8UcPO6PlDQWbAtkzssxNH2ayaKWTNDmfaXsG5kd91wn6Czocv00 LS7hyqJaPDX42/1vJ3eh2AtjRms0UW+i2feyIi6iz1UCFWVEmEkHUFbJFlDX70M/LURO LGDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=67iChVcO9/wm/TRaCuDf/PEeqOS9FwkJk0+0RfT68ws=; b=VHRLnDdit+l4kz2E9Sla2SZcAfXdIIPlbgqeqb6xzEVicjiCd6n0EGeZQsFpsb7Ly9 FzPr3F+UVTdmkNaFC3rALg9uM9Z4dd/D1LYA4i1tbzzDFah8qQ7yTI1AVYSBT6lG35BM NspWH+w/7kjufixsbePehb0F//f5MB3h7x426crga9zhQhndmjdiPHA4/WrQalWdibLb U0gOwqEeoLewsmKkFRDJ1ZK5aLf7U4SLXXs/7PhLabbk5JRVwyoX5R3dlHQTARpH+iPe 8FdNvqodxDyf1mEqzztGZR8bqUJRo2Xl87mQL9rVKhV5VFYVfNFGIdx6bU2uDrpijWhX Ra7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=bBvxgc4V; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w7-20020a056402268700b004262e1e9368si721228edd.36.2022.05.12.17.41.27; Thu, 12 May 2022 17:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=bBvxgc4V; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351986AbiELROd (ORCPT + 99 others); Thu, 12 May 2022 13:14:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346772AbiELROc (ORCPT ); Thu, 12 May 2022 13:14:32 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2716726A707 for ; Thu, 12 May 2022 10:14:30 -0700 (PDT) Received: from cwcc.thunk.org (pool-108-7-220-252.bstnma.fios.verizon.net [108.7.220.252]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 24CHE8mL007381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 12 May 2022 13:14:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1652375650; bh=67iChVcO9/wm/TRaCuDf/PEeqOS9FwkJk0+0RfT68ws=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=bBvxgc4VLzAiTQYcE1+NaHkltJcE5wW0bdYDeAF1zLgxS8c7tLuG38WF0BlR1/fe4 a29DWHkV7Fyjss07bl3y0NSdJGY9fLWjgBJd9N/+Az2pcnPwgoTKwZHpWLmoFSv5i8 o/1qX6Dmlkim6ytng5/h57St8+C9SNzjXpgsfCSccZ6r8GOGFngqdrLWHFz8zBeLcm b0uTt4/ZzQ8MWmVw50b5N5ssEOKdsEHNr7EUiMylNx7MbjqzLumXMWysZkHFucIs5v T646x3vCXc8VnVVO1YpYi8yD0ppDBCgM+ErJ9YSM8Cr9ScaWFVBHax96MMgqdlcKaf f42H0a+KnxclQ== Received: by cwcc.thunk.org (Postfix, from userid 15806) id A14F215C3F2A; Thu, 12 May 2022 13:14:08 -0400 (EDT) Date: Thu, 12 May 2022 13:14:08 -0400 From: "Theodore Ts'o" To: zhanchengbin Cc: linux-ext4@vger.kernel.org, liuzhiqiang26@huawei.com, linfeilong@huawei.com, wubo40@huawei.com Subject: Re: [PATCH v2 0/6] solve memory leak and check whether NULL pointer Message-ID: References: <52a2a39d-617f-2f27-a8a4-34da6103e44c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52a2a39d-617f-2f27-a8a4-34da6103e44c@huawei.com> X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri, Dec 31, 2021 at 03:40:41PM +0800, zhanchengbin wrote: > Solve the memory leak of the abnormal branch and the new null pointer check Applied, but the patches were all white-space damaged so I had to apply them by hand. I also reworded the commit description to be clearer. The one exception is the patch to lib/ss, which had already been fixed commit a282671a0 ("libss: fix possible NULL pointer dereference on allocation failure") in my tree. Cheers, - Ted > Changes from V1: > --------------- > - In the V1 of the patch series, have a bug in patch 1/6, when s->s get > memory successd, s-len is not assigned a value. > > zhanchengbin (6): > e2fsck: set s->len=0 if malloc() fails in alloc_string() > lib/ss: check whether argp is null before accessing it in > ss_execute_command() > lib/support: check whether inump is null before accessing it in > quota_set_sb_inum() > e2fsprogs: call ext2fs_badblocks_list_free() to free list in exception > branch > e2fsck: check whether ldesc is null before accessing it in > end_problem_latch() > lib/ext2fs: call ext2fs_free_mem() to free &io->name in exception > branch > > e2fsck/logfile.c | 2 +- > e2fsck/problem.c | 2 ++ > lib/ext2fs/test_io.c | 2 ++ > lib/ext2fs/undo_io.c | 2 ++ > lib/ss/execute_cmd.c | 2 ++ > lib/support/mkquota.c | 3 ++- > misc/dumpe2fs.c | 1 + > resize/resize2fs.c | 4 ++-- > 8 files changed, 14 insertions(+), 4 deletions(-) > > -- > 2.27.0