Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp972269rdh; Sun, 24 Sep 2023 21:48:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHK++Me/18pG0USdtpFq3QgFyRBfl7kUTubqGoxGkbaH/uRxC9AL6PJb7fEFbt8n1wF5pI X-Received: by 2002:a05:6a20:7352:b0:151:577:32d1 with SMTP id v18-20020a056a20735200b00151057732d1mr7173616pzc.22.1695617331556; Sun, 24 Sep 2023 21:48:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695617331; cv=none; d=google.com; s=arc-20160816; b=yw6T4DPECEN3TRCqI6Jy44fVEyHgNVuY6cVcYNx7lOhVJkAjy8eBxitvGxQZaT3ABG O1X8GOvXJZYp54PGjD0kmhHig7c9n74CLQsImXZUS3nUUQqSj3DOVNPj977yg+/vv+0v YowJztC4OgXScfG+i1fHMah+pCrOZgSYHz3LWk1cfZ2joYTebzpdNeaQsWt3+PLpj5CV XtSmbjYPDjMDMIP3NNlP6dPLgoveEKEYSgSVAHVc0SeiM9ghyrKctLiTSqRbFiddleNP HoeS77gQ4u1+VYJrp8jGmt8sN4boFQ6qmuF2E+ceiMrQpc6h3hCFrjbi2fnlCdBTu4hM z0+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :in-reply-to:message-id:date:subject:cc:to:from; bh=c5b1sF3aeKABUuesHOg6Gk6XX2OP3CrkK86PSH2ijgU=; fh=J0GOusRKIfH3HTFLdddFmrgGd+5pi5zd3k/XYpvWj/o=; b=griViHUdZtuQsHq9bI+nidOYbwVG5xRZX6OxSEMdW+VHDnTBmENRGUZ4+c+3LKa8O7 QGtA82frwtq9q9VfChEyUWp9yMdH89G9QzI07m046btHvgakXa7yzMu/xqwBdOXEgr/p wVd2twu2f3EyuvtSG9cv4mekrzWhfdMGsOyatkeQnnEy8CSzMI/AIg0hD5JhgHgzqRST gTgLZOjTL6qNLuS2PfzovHtDsvjgOW7+KYcpjVK0sPrVWMD0SXHccCtjxxuWbLurXHaC ufuS4NDaSeSzneR125bTWARA8kxr6oth7F9KdmN7ePiHSh1xDl9CoZRlhqhVAwMbGLDH bemQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n5-20020a17090a394500b002740f8fa612si4870202pjf.21.2023.09.24.21.48.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:48:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 13A71829F645; Sun, 24 Sep 2023 21:48:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbjIYEsp (ORCPT + 99 others); Mon, 25 Sep 2023 00:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjIYEso (ORCPT ); Mon, 25 Sep 2023 00:48:44 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id DE3CAFB; Sun, 24 Sep 2023 21:48:37 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id EE2B96046F03E; Mon, 25 Sep 2023 12:48:23 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: almaz.alexandrovich@paragon-software.com Cc: Su Hui , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] fs/ntfs3: Avoid possible memory leak Date: Mon, 25 Sep 2023 12:48:07 +0800 Message-Id: <20230925044807.92037-2-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230925044807.92037-1-suhui@nfschina.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RDNS_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 24 Sep 2023 21:48:46 -0700 (PDT) smatch warn: fs/ntfs3/fslog.c:2172 last_log_lsn() warn: possible memory leak of 'page_bufs' Jump to label 'out' to free 'page_bufs' and is more consistent with other code. Signed-off-by: Su Hui --- fs/ntfs3/fslog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index 12f28cdf5c83..98ccb6650858 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -2168,8 +2168,10 @@ static int last_log_lsn(struct ntfs_log *log) if (!page) { page = kmalloc(log->page_size, GFP_NOFS); - if (!page) - return -ENOMEM; + if (!page) { + err = -ENOMEM; + goto out; + } } /* -- 2.30.2