From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C235A034F; Tue, 28 Dec 2021 10:17:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE8744067B; Tue, 28 Dec 2021 10:17:23 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by mails.dpdk.org (Postfix) with ESMTP id 0466940040; Tue, 28 Dec 2021 10:17:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=neSzQsGsPY3ugAAg+3bQhWrdS9umUT/PlonXVcn9FhfkEPq+i1XPO4QL4MDMDdaXITFRqn1imrCowLLKBT3QohK8Yfu5z6/sELl1ahx6DpYfaUkjfm5GrQ0DteQfNf2m3Wqf4bktIQsvJm5XQLEPm4pp+hVdSSa/Lq/rqDwLdlrecB0SxCRXdlsD7feRqeasnUsYQxLx6kArWFIAqkznTBM58n7BXYwgRagR50erSCT9OIylCbqI0gFm/xj2TysvrK01NApIIwWpyC9/aTNBMkKz4SHaiu6TtxJ3MuUhn1oZnUL7L+IVAodLtx6Ej8iRYvrfrSsJ5xKpBiLXn8tkRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iipR7FuEqoOIOMl6Q8/fR4puMp5j1uQR3KcDwZYD30o=; b=nY1ZU/zQdvypwcd8KLzB7GABDP7yOSvyhoI17XnXayTBdoZ79K4wOsU/s2HUGNomdQRytWfNreFVv8qNUHWMpema+vZg2O1JhLVzusmu+AUb8Zhz/mZ0WvcsI+jjEUUPj3xN4MLJTmmIxT0IJR2O3YB2ZY4zAhwmppjHHhdM9pJxyvthl6StON6kjWgfcOtjtIunV47TTFRhbJPW87jlBGejOcle394Z80bpGMJ+r298BHeeg5X5keIbR5CkI9u2nwV8ubCqadP4J1FOWNRnolrehdccQSg+6vXi/RyBeG3+LgEyX2ViTc/T5MCGFv7X5+pstk4EeB3WOwe6CrMf9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=networkplumber.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iipR7FuEqoOIOMl6Q8/fR4puMp5j1uQR3KcDwZYD30o=; b=TyiAti0/cG2dMv8ls3hOqoJO5NZl84Ej8/iCdJnOXZTlJANWXWf5YBaoezqQvxIRmcvyzSynCOHivR2quTjesSDc+No3C4aeW6rQOrIbTBX/KpeIBasyMAWTcJglLa6enzkZIkn8P79Y3AayI7nctyNgLRDSai2D0Ay9pao17Ezj2rZsNrGrP4Rs+4G6DypqziEJ+NWgOpsN4NSqmlBXlrboCxrRSZRDIBHcMkS+GFvCVLIeJyTHQkBr1lYLfBz+y8yR4904M9iTlhdJvRBaQlMcvR/AaOdpegOql4Odew3fBdI2zoop5tuFUvJ/rlkOqepARjHsT9rmhgJ/4C27WA== Received: from MW4PR03CA0226.namprd03.prod.outlook.com (2603:10b6:303:b9::21) by DM6PR12MB4433.namprd12.prod.outlook.com (2603:10b6:5:2a1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.21; Tue, 28 Dec 2021 09:17:21 +0000 Received: from CO1NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::3a) by MW4PR03CA0226.outlook.office365.com (2603:10b6:303:b9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18 via Frontend Transport; Tue, 28 Dec 2021 09:17:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT014.mail.protection.outlook.com (10.13.175.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4823.18 via Frontend Transport; Tue, 28 Dec 2021 09:17:21 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 28 Dec 2021 09:17:20 +0000 Received: from nvidia.com (172.20.187.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.9; Tue, 28 Dec 2021 01:17:18 -0800 From: Dmitry Kozlyuk To: CC: , , Stephen Hemminger , Matan Azrad , "Viacheslav Ovsiienko" Subject: [PATCH] net/mlx5: fix GCC uninitialized variable warning Date: Tue, 28 Dec 2021 11:17:03 +0200 Message-ID: <20211228091704.3359132-1-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c47977b7-8ff2-47c6-ce8a-08d9c9e2da54 X-MS-TrafficTypeDiagnostic: DM6PR12MB4433:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pCT+eTHQR5cHT7yvfsrpsgxUEJ614VZtgIou91V1ju62maXlXA7dkoL3GOCGSH+oCZpeBFYVx072hgHrI+nGOyXQ0TPL0JphCNMrPMu5Z2WHT0cGkssY2hv/rEWTLv8cMBIox1NkzagdUZLMqaOMSx1IztdZtZHTx1JAc2kSnkNmL3oS85/g3F6sjGaSN+MYE82PRnjh5GNXOexh8G3ARcOPuFBTWNReRB15n+w5NIEbIN4kHFQYw3n1TXR6Kx8ac8sEbOav7QQavJduKEwHuvMfyDicNI7Zzxzmvf665YrDczVVwLj86bfRK5SmMRIMHvaQ05Sp8JuDO1qouAB3LxqV1NebzWZ0ma0r16/TcoceSRAY4DHD0DSoswGePynYR/h0p922RruqpAoCZRKVX5riyEaWY/xosFhc6qWBb04u517s3jelk+iUPf+EU3Dj+K7RYJDPRh+B8x7H6DY49zOVJ1CxlOd6jOtXI4P9dZG+zGKkkkPhpigXfkaTGbYf3tWs07GRY9rKtEROHsO/2OnUlidNNkaloO5F/CBV63pURGgegi6if/kXPfGX5MZUzdpo+gNSeVXQt28e72eRChksvAWdTMW0OQnA2KQ9hYP5674RAS7jb4L58KCTtQ/xmxkFLzjg5faYhmNHugdITB1V4bs39Ywv3WLdBICKfmdFgtLOxuBVnaQXweLyw3tqS9WWEcXPtPXXpyYTGIHYvd7iKc7rnYUFiCqZXHr97oTE0a+jmkyaUvX/y28flFgNOMqAg4G8bAas4mMDMtanZobb9IHbaOcn5AAPJs3arXs= X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(8676002)(508600001)(16526019)(1076003)(2906002)(36860700001)(336012)(186003)(5660300002)(47076005)(6286002)(83380400001)(6916009)(6666004)(7696005)(4326008)(54906003)(316002)(356005)(55016003)(8936002)(40460700001)(86362001)(107886003)(70586007)(70206006)(2616005)(36756003)(426003)(82310400004)(26005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2021 09:17:21.1324 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c47977b7-8ff2-47c6-ce8a-08d9c9e2da54 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4433 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When building with -Db_sanitize=thread, GCC gives a warning: drivers/net/mlx5/mlx5_flow_meter.c: In function ‘mlx5_flow_meter_create’: drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be used uninitialized in this function [-Wmaybe-uninitialized] This is a false-positive: legacy_fm is initialized and used if and only if priv->sh->meter_aso_en is false. Work around this by initializing legacy_fm to NULL. Add an assertion before legacy_fm use in case the logic changes. Fixes: 444320186393 ("net/mlx5: support meter creation with policy") Cc: lizh@nvidia.com Cc: stable@dpdk.org Reported-by: Stephen Hemminger Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_meter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c index f4a7b697e6..fd4f286deb 100644 --- a/drivers/net/mlx5/mlx5_flow_meter.c +++ b/drivers/net/mlx5/mlx5_flow_meter.c @@ -1167,7 +1167,8 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, struct mlx5_legacy_flow_meters *fms = &priv->flow_meters; struct mlx5_flow_meter_profile *fmp; struct mlx5_flow_meter_info *fm; - struct mlx5_legacy_flow_meter *legacy_fm; + /* GCC fails to infer legacy_fm is set when !priv->sh->meter_aso_en. */ + struct mlx5_legacy_flow_meter *legacy_fm = NULL; struct mlx5_flow_meter_policy *mtr_policy = NULL; struct mlx5_indexed_pool_config flow_ipool_cfg = { .size = 0, @@ -1273,8 +1274,10 @@ mlx5_flow_meter_create(struct rte_eth_dev *dev, uint32_t meter_id, if (mlx5_flow_create_mtr_tbls(dev, fm, mtr_idx, domain_bitmap)) goto error; /* Add to the flow meter list. */ - if (!priv->sh->meter_aso_en) + if (!priv->sh->meter_aso_en) { + MLX5_ASSERT(legacy_fm != NULL); TAILQ_INSERT_TAIL(fms, legacy_fm, next); + } /* Add to the flow meter list. */ fm->active_state = 1; /* Config meter starts as active. */ fm->is_enable = 1; -- 2.25.1