Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2931426iog; Mon, 20 Jun 2022 07:44:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sxiiG8bFAAujWMbBAetSK20g8EcDMq/K84aT7Urap8W7fCWrS2jqbZK7ZdjF4th1aTdsrD X-Received: by 2002:a63:4853:0:b0:3fa:dc6:7ac2 with SMTP id x19-20020a634853000000b003fa0dc67ac2mr21937850pgk.298.1655736276058; Mon, 20 Jun 2022 07:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736276; cv=none; d=google.com; s=arc-20160816; b=IsSsbx8rWi8C/nxPlpSrTUPpGTGFACaCB/fWOjV5UtShZJ2TYhaNd0p+beginWHHu+ y2g8hNfoYT70N4qPQb8wXa2b76oJpAzZbBl9FsJaW9NhUvAg3r3ywyS3Lg1YI+hJPCU0 wg3z4mE6PTl/VZp9nIzJxGbKWDaRI0OQRxrTUeTFUy1Q3xIMMXL0FmC+CFsTiRJ80hfQ +pNoOuJ/3DYvkiARajT3DHy6gHZadSDKfWzCcTPx5pdveOxo5e14a/CzU3XFEatBhcpR OeE88dWD/F9afFbjVCY3536tTK07WIv7RCaQzPfxDQwp7CtWrKOSumAaLYObepc/y4ew 5rrA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jI2VzzrCg/RcLh3D1eMcYb3ajbIQq8H338gsGod5kDQ=; b=DpVJQo1+tvqzXVWN2CLY7uOjSzirSaISq3bZOhQd7xfJAUUvwjc1lvy+eOCyUKFQiA 9ct9GnnJzqX65TueQlyJiIvhZcb//L12SRmmcayC4AKEbW9DIrm/iynRdiANkVYidrra 8jh3s39XCN5LUN7fiG6Hxv/ZMhTUkyChXbOZStVhYp/EyJ/WeLVCkpxBffXmzpOwTLGR tRlmqz/AxrREnyCdGR1Fg/e2XPUurW/ziCmgAUfoBNbhnK6sIROBfsQipo2r7Ers0Ntj 3R+9mMryPg7MERqjv58h5BUEAO1D4WOTg40hcxeyv1E7kLEJCo/NVylUDanYV3OxQewo 9DJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WPNG59mn; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 142-20020a630294000000b0040c74ec4000si9617788pgc.341.2022.06.20.07.44.23; Mon, 20 Jun 2022 07:44:36 -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=@linuxfoundation.org header.s=korg header.b=WPNG59mn; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243277AbiFTMz6 (ORCPT + 99 others); Mon, 20 Jun 2022 08:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243184AbiFTMzL (ORCPT ); Mon, 20 Jun 2022 08:55:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4AA193EA; Mon, 20 Jun 2022 05:54:41 -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 D189A614F0; Mon, 20 Jun 2022 12:54:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD766C3411B; Mon, 20 Jun 2022 12:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729680; bh=3+TjRApg31Kdh5COe4/h8BpJnLyMhiRmcAOy4HX2bjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WPNG59mn6QIm7v35j2xuc8Z+Z+u+sf6ZkYH0FO4ZpFwS2HX05CJ7X1NKZJJzDYP5S HbXxN7vpvvP7DGqicICDEaW1slvYXNOtXTco4uan9AVoeGOcCGxNi3kl4CiWk6/ZBk 72EyH3ZOAhjr5ak6GlKQiIDJ3jR8+NKnbb3mQgsk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 041/141] mellanox: mlx5: avoid uninitialized variable warning with gcc-12 Date: Mon, 20 Jun 2022 14:49:39 +0200 Message-Id: <20220620124730.749469733@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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,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 From: Linus Torvalds [ Upstream commit 842c3b3ddc5f4d17275edbaa09e23d712bf8b915 ] gcc-12 started warning about 'tracker' being used uninitialized: drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c: In function ‘mlx5_do_bond’: drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:786:28: warning: ‘tracker’ is used uninitialized [-Wuninitialized] 786 | struct lag_tracker tracker; | ^~~~~~~ which seems to be because it doesn't track how the use (and initialization) is bound by the 'do_bond' flag. But admittedly that 'do_bond' usage is fairly complicated, and involves passing it around as an argument to helper functions, so it's somewhat understandable that gcc doesn't see how that all works. This function could be rewritten to make the use of that tracker variable more obviously safe, but for now I'm just adding the forced initialization of it. Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c index a8b98242edb1..a1e9d3051533 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c @@ -561,7 +561,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) { struct mlx5_core_dev *dev0 = ldev->pf[MLX5_LAG_P1].dev; struct mlx5_core_dev *dev1 = ldev->pf[MLX5_LAG_P2].dev; - struct lag_tracker tracker; + struct lag_tracker tracker = { }; bool do_bond, roce_lag; int err; -- 2.35.1