Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2517234imw; Wed, 6 Jul 2022 07:16:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vePR60KMx6t0jskpLKa/rd80aK3Ssu2GqYLmxeX/YCUJZ7FuCXEWNOr55fJ8bDsDg3/IeT X-Received: by 2002:a17:907:3e03:b0:722:e694:438 with SMTP id hp3-20020a1709073e0300b00722e6940438mr39463827ejc.755.1657117001924; Wed, 06 Jul 2022 07:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657117001; cv=none; d=google.com; s=arc-20160816; b=MJIAxk66qa9KzGyp5hPSgSklvAgTApChKtA4IIzy1Hk4BN0gb10s/7ZxLeTKn4jDNO w7OFD4dSnTDt8DXDjGDzuWtJivKCNhcWIDIlQ4CTjFUaw6yE6AuMHorBkhhS8i9XJUBb siIF01Gdy+vxOoxM+j3OyhLGDnv+ObLWzgZd2N1hbYcCDMBIqejXEFnde9QPRW8WEYhw EW72zsWlhorVaKlJsHhj7Bhr9CemCPv53FpTGFiCaURVWnJEPi3rMdoy0exYpx38bfJ9 p+iuwqTYnV0W+rsXnGekUKwAA8TgmYqfqEFD6hZT5VER6/fJh+OIdU4CN3F2TWNvA8VG K4cw== 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=FRMiSqB+Z1ZuNrhKGtkfPbUfyYKbW5WXISHI13u7Fns=; b=ayJmCeI5ldM6V4c5ybo9Ek4S0JMD7W3x0z9njEzCV5/HYy5raElVWHZIbaKem0aVrF iybOmubQXsZKC6QL5GnT3djLNGLh8zqGaC/l1okRdY5iMR0QTET0a9PQ20cbxXgmqSWI nZB1G1bJugSxaRJoTog9La20gNhocSMqMLJrSeRVLhfIBZQR3FeOqJPGAUm+RhmU6PwS bLeCHWFIUMqrOqPB3wTAJ+5muMrU8yrhpDTAHAtlfg7yvWNo65PIOkhddg1bMtwMOUf2 IhDgErUQHbowVIZGxs8g1CT7R4+IUL66PYmNDkcUdM/8zFPkTJNT4B/pDHJKBfIbPKvB YAGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a0564021e8a00b00435a061d699si9479872edf.588.2022.07.06.07.16.16; Wed, 06 Jul 2022 07:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232519AbiGFNgw (ORCPT + 99 others); Wed, 6 Jul 2022 09:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232239AbiGFNgu (ORCPT ); Wed, 6 Jul 2022 09:36:50 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED44B5F66; Wed, 6 Jul 2022 06:36:48 -0700 (PDT) Received: from andrey-lpc.intra.ispras.ru (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPS id D6A4740737B9; Wed, 6 Jul 2022 13:36:44 +0000 (UTC) From: Andrey Strachuk To: "Darrick J. Wong" Cc: Andrey Strachuk , Dave Chinner , Allison Henderson , Chandan Babu R , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] xfs: removed useless condition in function xfs_attr_node_get Date: Wed, 6 Jul 2022 16:36:27 +0300 Message-Id: <20220706133627.11198-1-strochuk@ispras.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,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-kernel@vger.kernel.org At line 1561, variable "state" is being compared with NULL every loop iteration. ------------------------------------------------------------------- 1561 for (i = 0; state != NULL && i < state->path.active; i++) { 1562 xfs_trans_brelse(args->trans, state->path.blk[i].bp); 1563 state->path.blk[i].bp = NULL; 1564 } ------------------------------------------------------------------- However, it cannot be NULL. ---------------------------------------- 1546 state = xfs_da_state_alloc(args); ---------------------------------------- xfs_da_state_alloc calls kmem_cache_zalloc. kmem_cache_zalloc is called with __GFP_NOFAIL flag and, therefore, it cannot return NULL. -------------------------------------------------------------------------- struct xfs_da_state * xfs_da_state_alloc( struct xfs_da_args *args) { struct xfs_da_state *state; state = kmem_cache_zalloc(xfs_da_state_cache, GFP_NOFS | __GFP_NOFAIL); state->args = args; state->mp = args->dp->i_mount; return state; } -------------------------------------------------------------------------- Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Strachuk Fixes: 4d0cdd2bb8f0 ("xfs: clean up xfs_attr_node_hasname") --- fs/xfs/libxfs/xfs_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c index 224649a76cbb..6b8857e53add 100644 --- a/fs/xfs/libxfs/xfs_attr.c +++ b/fs/xfs/libxfs/xfs_attr.c @@ -1558,7 +1558,7 @@ xfs_attr_node_get( * If not in a transaction, we have to release all the buffers. */ out_release: - for (i = 0; state != NULL && i < state->path.active; i++) { + for (i = 0; i < state->path.active; i++) { xfs_trans_brelse(args->trans, state->path.blk[i].bp); state->path.blk[i].bp = NULL; } -- 2.25.1