Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp115625imn; Wed, 3 Aug 2022 22:26:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4vF1oPR3ScuJqOWgPGB/59HyWG7wM2dl8EiJ0jmixttcVJNE8CAX+SMih0HG1hDRIzsOLA X-Received: by 2002:a05:6a00:892:b0:52b:c986:c781 with SMTP id q18-20020a056a00089200b0052bc986c781mr257123pfj.64.1659590817213; Wed, 03 Aug 2022 22:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659590817; cv=none; d=google.com; s=arc-20160816; b=ewLTh4Q44sDekWWXiYyV+HZHf2JBOYyLNPYxUuknUoTErISp9fo2tiq13gRSORKJFR hAMfKmc6U9qc0v7rZnO2JsnhL4dnnjvanWRwYuVGjRoj+rop98sz2FgcHFOecNGNGg7Y Y+ZZ4VQBWmIwV+mUmpCk9BVclcy7jpKwN3XzBNbewn0pWpLh1J3iYNw+dM6bN3OzvU2O KPcGphiFp6wJNbOIZYWwCykjQwn8ha4sn5r3pSKK+tDUiwIk9zA9sKjyu9q5S5RADoYi XtLW5TiKGI9DWPV/HR1KiuMNlLIDFyuv3jIpmwnJkqo8FTxi1iQGbdoAOIHTQZxi9E2o 48tQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AdP2JzCZLdkIVwkXqBLKpMmNUuZeVXtyBu4CvX8aLHg=; b=Zj3xcd4Gh+1vKQUzN8PCUtYaUps+h3Ky9rBn7wwb3bxdtkZEzMRLiRAnewF8wFJjJF DK6VHrwmq+fwauUjkNR6V8HzOqvEas5rwzaxdsmFI2FDpFwiFQ6EB+m/4jFK4neVvE+2 lilerNmppU+UzjkSqhBhbIR+W26EPbzxbyxpEXXisK6BqtQOOAkyN12vFP+EuUzKTpr+ mjowH8jbBCRMsh10dIowBCn1igLAlCey6lXzlRZyg1zY2TTsI74lLshVWCMh1DdmR2TZ W2PFKYZvEFTYHlg42wTAyTAZf9L8AdMBJzcBkRTkGEHRsCaiZ7tfaw5z0oPuXz9YXPe6 6FGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=afgqW7Am; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a056a00234e00b0052541302f29si1533948pfj.359.2022.08.03.22.26.43; Wed, 03 Aug 2022 22:26:57 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=afgqW7Am; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238660AbiHDFHj (ORCPT + 99 others); Thu, 4 Aug 2022 01:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237625AbiHDFHh (ORCPT ); Thu, 4 Aug 2022 01:07:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB14E2250C; Wed, 3 Aug 2022 22:07:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C52961852; Thu, 4 Aug 2022 05:07:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7FCFC433C1; Thu, 4 Aug 2022 05:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659589654; bh=dntzueFUayg8EwtWI0uD8IPo2JnX77id+CydyT8ad2s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=afgqW7AmIsubIaZXxhWapTsgZQ8aMbjZDKgvMoR8wisyjeNYlL/zA/ydpJOh7BMCQ BNq6f5toPXQQSab81c6m/cBha4GnfTKoYsC2FQD9A63nkdCSgd98Bx8d2qCH3nIzBM 6uNRq+8kRY7kL6pGHie22QuIpD7zabm+/GV/461nwgIf0XTgk2noxdBBRPHBZGZ8y+ 6TFIkJNGHDFoJzwPFf8RNERe+NNdFljC5AECmF3dtle7lW1Zz36Zb8MiiCHH1TBML9 xQqcco3wVr/iLI304DtdXx93lfIw1FzEucxhmmAlP0tpusQ/ua/0oqKgPta91HdZf/ 6h76lhzzZ3MlQ== Date: Wed, 3 Aug 2022 22:07:34 -0700 From: "Darrick J. Wong" To: Sherry Yang Cc: Dave Chinner , "dchinner@redhat.com" , Allison Henderson , "chandanrlinux@gmail.com" , "bfoster@redhat.com" , "linux-xfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1] xfs: initialize error in xfs_defer_finish_one Message-ID: References: <20220801190311.65703-1-sherry.yang@oracle.com> <20220801204902.GA3600936@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Wed, Aug 03, 2022 at 11:42:21PM +0000, Sherry Yang wrote: > > > On Aug 2, 2022, at 9:31 PM, Darrick J. Wong wrote: > > > > On Tue, Aug 02, 2022 at 06:49:02AM +1000, Dave Chinner wrote: > >> On Mon, Aug 01, 2022 at 12:03:11PM -0700, Sherry Yang wrote: > >>> Path through non-void function 'xfs_defer_finish_one' may return error > >>> uninitialized if no iteration of 'list_for_each_safe' occurs. Fix this > >>> by initializing error. > >> > >> I didn't think this situation was possible - how do we get deferred > >> work queued with no work items on it? > >> > >> If we can return an uninitialised error from xfs_defer_finish_one() > >> because of an empty queued work, then something else has gone wrong > >> earlier in the work deferral process. If this can actually happen, > >> then we need to fix whatever is creating the empty work rather than > >> paper over it by initialising the error being returned for empty > >> works... > > > > /me bets this is a response to a static checker that doesn't know that > > list_empty(&dfp->dfp_work) == false in all circumstances. It's not > > possible for tp->t_dfops to contain an xfs_defer_pending with no work > > items. > > Hi Darrick, > > You’re correct. This is a false positive bug detected by our static code > analysis tool. Sorry for the noise. Well, thank /you/ for running smatch/sparse/whatever on the XFS code base. Let us know if you find any other oddities, since it does tend to find things every now and then. :) --D > Sherry > > > > --D > > > >> Cheers, > >> > >> Dave. > >> -- > >> Dave Chinner > >> david@fromorbit.com >