X-Received: by 2002:a17:90a:4289:b0:1bc:275b:8986 with SMTP id p9-20020a17090a428900b001bc275b8986mr13766603pjg.153.1645701010213; Thu, 24 Feb 2022 03:10:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645701010; cv=none; d=google.com; s=arc-20160816; b=gIJAlWUQlq3G9rbc3AZUsvZwybNk56olIJk/jWqfLB7ARAWdKOZprWWBorVhgXWncO aLCjri1DcgkJPrgIwGDmt1Sk7bvME62nRUUgzih+INcqariFEJcATzY16771SRU2IhK+ FI+QQvj2xkSCPWDpi/k8s6JjVN9sf3ZBMuayoiB9e0w411IU6ts2ZI11/cP95TmDGapd BMV8g8GO4bv9zqe8ysc387DECWVgDeMtTtYT/qlCdeoDuZ179WUQ0F8Hd15teifT3maX gLcznk06iAPVnrkuRNXM1CndjLRUreug16wRA47kas9muGTaTgET7yMFNoafPn+PwtEq wBfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=C332AhrDIlzT/2XoIViHK7bqj7AuxbydaVZvJnTmdTY=; b=Xj/OOupLoC93VdhmcGzJ6IGdGpfLh4XRTJqKy3Pd9f4JouLva4XBfwbODmfgg4XBTU Z6jGve6rPozOGlrHJ3l5WD4xUN3ayo+EJWdW7ZhiWDD+LasGtk9N03FjubyXd9N5ubdO ppTtNsnfzvwbinMfDsTK5j4f4Vw4DHb3C+t9RJA014Cy6vqjIfrirmzU1NzLj2LqvjNx axtxy+iEYsdcnVo6WAphIoCTr9Z0Jdkfv/oiGk9A4rpYpQhg6n9mROe+pQ4H5EHaIXMl LHFXZaM9gqpbGurScMSqS2xYyToQZihFSNzs/qDKxi8wo8JK+9stVTud66B4iy/aO0Mr 4+cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=hJUDoDIk; 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=gmx.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4si2321017plh.412.2022.02.24.03.09.54; Thu, 24 Feb 2022 03:10:10 -0800 (PST) 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=@gmx.net header.s=badeba3b8450 header.b=hJUDoDIk; 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=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232425AbiBXJ5w (ORCPT + 99 others); Thu, 24 Feb 2022 04:57:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbiBXJ5t (ORCPT ); Thu, 24 Feb 2022 04:57:49 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA7317070; Thu, 24 Feb 2022 01:57:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645696617; bh=C332AhrDIlzT/2XoIViHK7bqj7AuxbydaVZvJnTmdTY=; h=X-UI-Sender-Class:Date:To:Cc:References:From:Subject:In-Reply-To; b=hJUDoDIkTmmgyqDMp8CywHnVIVZ3QH2hSBdSRJ/Bj1cIMUHXRaCP2kzsxKQf3KqpU +zXZdIV1+07BbWCj5OMsQQ1DItLvef4gmAzMCPw7evTwyJa2O0IsHi2jhWsRJhGbuW bEZmbU62/9JcQIJRHCH52WlWTwprii0DJ5E6+Hg8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MdvqW-1nuqze24EY-00b2BT; Thu, 24 Feb 2022 10:56:57 +0100 Message-ID: <205e5941-6ae0-0482-b083-874daf0e5a46@gmx.com> Date: Thu, 24 Feb 2022 17:56:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: en-US To: Yujie Liu , Qu Wenruo , Souptick Joarder Cc: Chris Mason , Josef Bacik , dsterba@suse.com, nathan@kernel.org, Nick Desaulniers , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, kernel test robot References: <20220220144606.5695-1-jrdr.linux@gmail.com> <0a2e57ad-2973-ea01-ceda-3262cde1f5aa@gmx.com> From: Qu Wenruo Subject: Re: [PATCH] btrfs: Initialize ret to 0 in scrub_simple_mirror() In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Y3w1cSk5CyKdUvcBcH7SHZzqBGO/AIkIUDmfQ9EPXDacHy9yCkt iWTDFG9uPyOGG1CPtqA9esJUdBnRE2wgJjaTjEslssQMomDhUs6xOpBzM8xva9tuPsgzwmn aQ6hrmpUtRXDR6v2FS9fWTI7nUE+N1dU4/0vKJsiu4JcEQCVv0M3ZqwUMurYcTYXV34MdR1 t1UBkDFYBapvZeJbgLNEg== X-UI-Out-Filterresults: notjunk:1;V03:K0:CbhHkVsKYkI=:DQAbSz6tP7yo27vVEv4KXt hvq+4l5HUVTtY6s00/JFu/ScxELHHs0dbAOr1/9rJ9p9PA0+M+oQuTrIwAG+GJlIH/aFwt/So nJ6NelIwIsDTP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, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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 On 2022/2/24 17:48, Yujie Liu wrote: > Hi, > > Sorry for the noise of this false alert. No problem at all, in fact your bots are awesome detecting real bugs like previously it detects some uninitialized values from my patches. Kudos to your guys! LKP bots really rocks. > > For clang analyzer reports, usually we do internal check firstly. We'll > send out the > report only when we think that it is highly possible to be a true alert. BTW, do performance benchmarks also go through the same procedure? Although your bots are awesome at detect compiling warning/errors, sometimes it's not that straightforward to reproduce the same performance regressions. So it may be worthy some extra steps to verify certain performance regressions. Thanks, Qu > > We scanned our report history and found this report was produced on > 1/26, but it was > still in the internal check domain and was not likely to be sent to Qu > or mailing lists, > so we are kind of confusing about this consequence. > > Souptick, could you help to provide the original report by link or > attachment? > Then we can do some check to figure out whether we have any flaw in our > process. > > Thanks, > Yujie > > On 2/22/2022 16:04, Qu Wenruo wrote: >> >> >> On 2022/2/22 15:50, Souptick Joarder wrote: >>> On Mon, Feb 21, 2022 at 5:46 AM Qu Wenruo >>> wrote: >>>> >>>> >>>> >>>> On 2022/2/20 22:46, Souptick Joarder wrote: >>>>> From: "Souptick Joarder (HPE)" >>>>> >>>>> Kernel test robot reported below warning -> >>>>> fs/btrfs/scrub.c:3439:2: warning: Undefined or garbage value >>>>> returned to caller [clang-analyzer-core.uninitialized.UndefReturn] >>>>> >>>>> Initialize ret to 0. >>>>> >>>>> Reported-by: kernel test robot >>>>> Signed-off-by: Souptick Joarder (HPE) >>>> >>>> Although the patch is not yet merged, but I have to say, it's a >>>> false alert. >>> >>> Yes, I agree it is a false positive but this patch will at least keep >>> kernel test robot happy :) >> >> I'd say we should enhance the compiler to fix the false alert. >> >> Thus adding LLVM list here is correct. >> >> >> To me, the root problem is that, we lack the hint to allow clang to >> know that, @logical_length passed in would not cause u64 overflow. >> >> Unfortunately the sanity check to prevent overflow is hidden far away >> inside tree-checker.c. >> >> Maybe some ASSERT() for overflow check would help LLVM to know that? >> >> Thanks, >> Qu >> >>>> >>>> Firstly, the while loop will always get at least one run. >>>> >>>> Secondly, in that loop, we either set ret to some error value and >>>> break, >>>> or after at least one find_first_extent_item() and scrub_extent() cal= l, >>>> we increase cur_logical and reached the limit of the while loop and >>>> exit. >>>> >>>> So there is no possible routine to leave @ret uninitialized and >>>> returned >>>> to caller. >>>> >>>> Thanks, >>>> Qu >>>> >>>>> --- >>>>> =C2=A0=C2=A0 fs/btrfs/scrub.c | 2 +- >>>>> =C2=A0=C2=A0 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c >>>>> index 4baa8e43d585..5ca7e5ffbc96 100644 >>>>> --- a/fs/btrfs/scrub.c >>>>> +++ b/fs/btrfs/scrub.c >>>>> @@ -3325,7 +3325,7 @@ static int scrub_simple_mirror(struct >>>>> scrub_ctx *sctx, >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const u32 max_length =3D SZ_64K= ; >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct btrfs_path path =3D {}; >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 u64 cur_logical =3D logical_sta= rt; >>>>> -=C2=A0=C2=A0=C2=A0=C2=A0 int ret; >>>>> +=C2=A0=C2=A0=C2=A0=C2=A0 int ret =3D 0; >>>>> >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* The range must be inside the= bg */ >>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ASSERT(logical_start >=3D bg->s= tart && >>> >>