Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp972225rdh; Sun, 24 Sep 2023 21:48:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKDCjLpDNwDDl9JsDDNqZMpYBVqdfm+YmOIFYUDu0hL5BRRU5TcollK0Gsl8S66OC1VcYA X-Received: by 2002:a0d:f884:0:b0:59b:dbb7:5c74 with SMTP id i126-20020a0df884000000b0059bdbb75c74mr5766596ywf.32.1695617321280; Sun, 24 Sep 2023 21:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695617321; cv=none; d=google.com; s=arc-20160816; b=BrfNonlhRjscW4YF/C62OgTNoy/3ncv7wvnLmMHog+n6fvd2eo2xwv1AX19K+843FS C7O7MyTc/qSXMeb6GczDSV9Wu2zjy+rM/glV4xoeDjHHc6QAXC6Yzu+HDt65/3j/Kpn0 w4oy1nioZKWL69ybqyfVPZ4Nh0YhNokFr4J7WFrlO0tnIP0lSUgPBsuEeHD4h9J0cvvx krgUJDpuxPGR5i5hUTwPPbm5jHhli1lVWF029n1+6jXYJjSoJ+B1I+b2MAQPWTRT/NXe TpFnrSQMYEIHQyMiPWPInhDec/a0BhZEVeBNU/shgfVlA96lk3VE9ntaol6Oo4NZPN3z 0OMw== 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 :message-id:date:subject:cc:to:from; bh=XeemQ+vahjIsOQInJ1Q0QNxpZ5raPiJN7LLRoZLWwew=; fh=J0GOusRKIfH3HTFLdddFmrgGd+5pi5zd3k/XYpvWj/o=; b=rafgigyBIVaTf+UG70fy+t0aadD56U+7FdTMyWxR01rj3cwhHRQRBF5xzhbG+xpTt4 9zkUN0HqpXal1NoWaOg4/11+0eu6rx6oAsJ71U9gFOukUye6xlFY3rFHUCWfONXnxM8e lPedKiJpbobHEj73CVGI/XL+ZqwXUkBadqypEW6Am6j1WzL3c8cDLhj9bSk8jDkoM9Kz BB6QRn2lHg8iqMotlAhwhESsQJWRcZmObCM/12l88G74OEDvB75gsoS/6MRfAI3XdOo7 W/xEvUuM6pR+4mxdmxQmlW+lZ4vjyHEAHe465/IIPyxbPXBnPPRFVa9RXjPdVUM4CYvS r3gQ== 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:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i190-20020a6387c7000000b0057ab7f46381si8870609pge.76.2023.09.24.21.48.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 21:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 0325A8025043; Sun, 24 Sep 2023 21:48:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbjIYEsi (ORCPT + 99 others); Mon, 25 Sep 2023 00:48:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjIYEsh (ORCPT ); Mon, 25 Sep 2023 00:48:37 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B803DDF; Sun, 24 Sep 2023 21:48:29 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id E31A36047A8C6; Mon, 25 Sep 2023 12:48:19 +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 1/2] fs/ntfs3: Avoid possible NULL dereference Date: Mon, 25 Sep 2023 12:48:06 +0800 Message-Id: <20230925044807.92037-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Sun, 24 Sep 2023 21:48:38 -0700 (PDT) smatch error: fs/ntfs3/attrib.c:1826 attr_allocate_frame() error: we previously assumed 'attr_b' could be null (see line 1739) Return error code directly if 'attr_b' is NULL. Signed-off-by: Su Hui --- fs/ntfs3/attrib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index a9d82bbb4729..ebc934ac5cf5 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -1737,8 +1737,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size, attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b); if (!attr_b) { - err = -ENOENT; - goto out; + return -ENOENT; } attr = attr_b; -- 2.30.2