Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp464590rwl; Thu, 23 Mar 2023 19:36:15 -0700 (PDT) X-Google-Smtp-Source: AKy350Zwz14Xajp9U9qQTo8CtADkrXZAHAIu0GmJINOMQ6V5peaxqdGOdvYXTLbVG35mBTHfuYmw X-Received: by 2002:a17:902:e354:b0:1a1:e4c6:1e04 with SMTP id p20-20020a170902e35400b001a1e4c61e04mr744564plc.43.1679625375523; Thu, 23 Mar 2023 19:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679625375; cv=none; d=google.com; s=arc-20160816; b=FgyGNTRd++oE68UQPykfRJ5O4iDoP5CDkVrddIGHMsPqCR+YzRm6qeAsVHoe9eOyyg qfrMPeK5Jtnh3pzVPE326SDLlrhI65Mqg9brcJqjMu5mhANRdYzM25Njed/QxUOt1H+7 jTS3xv0TZtFG30tF7ribv031BZKz3EflZgJNiAGpC7d5mHQNGAUQjY4+fiaDE2Corcwg btLRcZYf+sAPxCXHOb6wolrtq+KXUiBrAf4B7mNyS1wTv3NFQtEEBCNPDwHU10UhunEa 7zGTMrx13+nTdcH7tFAzqpk2SUDRBSyDUdVarW+2uvGT00dLMFVCS94lGwiCmxAz/c5J OaGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=sdIFxlKHqyPQauC3EA1CD6YM6MLgr5BPAenLXoxp8A4=; b=YS/bnHaLDwaGq1TS8YH2LPXkSbptdKVO1EQ67ZS1L8yHbX9McnTFraX8Q/D7CRWpGN +ggV4JhQLfq/901Mo7bqk1v2Py5H4bE2GXsxU4o/iszG3bWeiKVskPVG23CfdaVl72QP V9hJdMjewS1Lyvj9RpOHotSUsIFHIp0xVgcUVQEF34qCdH0z+jGhA+SJ6uDWGb78s5h5 agGt+xWbt3abHB5gjC2oQJXkcXJyX4NE60qR1KTjO3j8dKMX8yU8ZmaotiYFHfCmdkpE 2SMjIprTm+qkgQRQNBX8b8LLDw0nkT8e+sshikGImNXitAFLng+6FY+U0MQjDlx0PS3m fyHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=UTEBNWwE; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j70-20020a638b49000000b0050faad0977dsi9081741pge.594.2023.03.23.19.36.03; Thu, 23 Mar 2023 19:36:15 -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=@suse.cz header.s=susede2_rsa header.b=UTEBNWwE; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231687AbjCXCfU (ORCPT + 99 others); Thu, 23 Mar 2023 22:35:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjCXCfT (ORCPT ); Thu, 23 Mar 2023 22:35:19 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC1E9113C1; Thu, 23 Mar 2023 19:35:17 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 75FCB1FE65; Fri, 24 Mar 2023 02:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1679625316; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sdIFxlKHqyPQauC3EA1CD6YM6MLgr5BPAenLXoxp8A4=; b=UTEBNWwEiVAYDqhzhkGZAYjd0E7bKXT7WR8ZiErR8zbK/ak3DFu+vj+GpzXqNFdUP2PnUs nBTzujqkrdSxnbEbvOdB5BYA7DUrijKNBzDYfn7d90g0B7P9k83JzJ7M7iN5ZqyAdW03/h o+2rbUH4a0M6kMUG0rCbK88y/StmsIk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1679625316; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sdIFxlKHqyPQauC3EA1CD6YM6MLgr5BPAenLXoxp8A4=; b=d35aHSEWmViEqFzHhayXYZ9KWzcDAXvUusXk8N6HMgyczMHcwkValIs17Uhr/i1ZyXiKDQ aU7L5JLmTh/SkXAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3813C133E5; Fri, 24 Mar 2023 02:35:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id roqaDGQMHWQAYwAAMHmgww (envelope-from ); Fri, 24 Mar 2023 02:35:16 +0000 Date: Fri, 24 Mar 2023 03:29:04 +0100 From: David Sterba To: Qu Wenruo Cc: Genjian , clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Genjian Zhang , k2ci Subject: Re: [PATCH] btrfs: fix uninitialized variable warning Message-ID: <20230324022904.GD10580@twin.jikos.cz> Reply-To: dsterba@suse.cz References: <20230324020838.67149-1-zhanggenjian@kylinos.cn> <78422b96-52ed-b48a-27d0-1cfaa89a6608@gmx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <78422b96-52ed-b48a-27d0-1cfaa89a6608@gmx.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 24, 2023 at 10:24:55AM +0800, Qu Wenruo wrote: > On 2023/3/24 10:08, Genjian wrote: > > From: Genjian Zhang > > > > compiler warning: > > Compiler version please. > > > > > ../fs/btrfs/volumes.c: In function ‘btrfs_init_new_device’: > > ../fs/btrfs/volumes.c:2703:3: error: ‘seed_devices’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > > 2703 | btrfs_setup_sprout(fs_info, seed_devices); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > ../fs/btrfs/send.c: In function ‘get_cur_inode_state’: > > ../include/linux/compiler.h:70:32: error: ‘right_gen’ may be used uninitialized in this function [-Werror=maybe-uninitialized] > > 70 | (__if_trace.miss_hit[1]++,1) : \ > > | ^ > > ../fs/btrfs/send.c:1878:6: note: ‘right_gen’ was declared here > > 1878 | u64 right_gen; > > | ^~~~~~~~~ > > > > Initialize the uninitialized variables. > > > > Reported-by: k2ci > > Signed-off-by: Genjian Zhang > > --- > > fs/btrfs/send.c | 2 +- > > fs/btrfs/volumes.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c > > index e5c963bb873d..af2e153543a5 100644 > > --- a/fs/btrfs/send.c > > +++ b/fs/btrfs/send.c > > @@ -1875,7 +1875,7 @@ static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen, > > int left_ret; > > int right_ret; > > u64 left_gen; > > - u64 right_gen; > > + u64 right_gen = 0; > > IIRC this is not my first time explaining why this is a false alert. > > Thus please report your compiler version first. This is probably because of the -Wmaybe-uninitialized we enabled, on some combination of architecture and compiler. While I'm also interested in the compiler and version we need to fix the warnings before 6.3 final. We'd be gettting the warnings and reports/patches, which is wasting peoples' time, it's not a big deal to initialize the variables. But still I also want to know which version reports that.