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 BCE52460D6; Tue, 21 Jan 2025 18:09:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 169C84065C; Tue, 21 Jan 2025 18:08:34 +0100 (CET) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 1542940609 for ; Tue, 21 Jan 2025 18:08:28 +0100 (CET) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2112.outbound.protection.outlook.com [104.47.11.112]) by mx-outbound11-0.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jan 2025 17:08:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C5Yh+iXJLLnUhZylB/e/sM5MqxMAJ210Gw/56fUIbIsAo9Zpo93slUKFjaaEpe7NCAU73aNSAzD6j8UDQSewMRrB+xUW66yrAuEjMsOIYClZTWksFIcbRWFfJjWvQZHnBT5i2IulgViT1sBuMD/tZGlygvR7jZVcTPuXyled/b3UoQUp9D51qWTe6tSnYO42WkAzTKYsq78I42NjXWUhYRCAx5coLaRMrvPTcAUV/qigg0zQI+BOxPUWjQ/qOfkHcd7of8T1JU+j7Z8STzxnEhR2FBjyijNlUxTi+61tA0sCIzQWS7ivRTxTtm8UoTBKzQeeeKJ2Pdxm5S3ciu8IqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=tlHhZZ9a2kkHpFMqW04E5US1XIu9MeYVaZ/Yzaq1AAQ=; b=YgxAwoOoDQm6QUvzPV49AlpuP2TeQTGKIiCRhmz+0W0s6lDFGQmRm9R0Rso/RR7IfivfW/2zZWqdAHPmk724hGM+eu40dIJb/zi1N4CPd7falpn67fJbWlxecq11bXN2COWTEz/yzDqGFyWBnxsM+J0DzLcajvK33sqOrOTtCmmzzUiJbNufnmi0vO1AfROGaKdnG5gDHs9ZjpNY21gVSbCeORCiGGNc08KrJNigJwW3wmPKZF16nu1FLugifoMCTEr3tlTzS66vhGLD8r7SGKKpgX9d2X3iizVruV+ScfACG83T93Pv/uVhZHHABDnEoFXgUIjnBgSuiIlm6cllfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tlHhZZ9a2kkHpFMqW04E5US1XIu9MeYVaZ/Yzaq1AAQ=; b=eDg2D6P6tZujIhv5TKSsgaHRqvMM3eRBKPZeWbJRa387sRAMbb+IyBXT4lokYQlp5AiGS5H0WTQvYYx3IxGY47Fyb+VTxpdml7YH9pEotwbav8fpS+uLtefVN04laZ8sO/fW818w25stoouLdeKjBQS2FUGa7Q4/52ru3e7GBQs= Received: from AS4P251CA0016.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d3::8) by DBAP190MB0854.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:1b0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.19; Tue, 21 Jan 2025 17:08:26 +0000 Received: from AM2PEPF0001C70A.eurprd05.prod.outlook.com (2603:10a6:20b:5d3:cafe::65) by AS4P251CA0016.outlook.office365.com (2603:10a6:20b:5d3::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8356.22 via Frontend Transport; Tue, 21 Jan 2025 17:08:26 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by AM2PEPF0001C70A.mail.protection.outlook.com (10.167.16.198) with Microsoft SMTP Server id 15.20.8377.8 via Frontend Transport; Tue, 21 Jan 2025 17:08:26 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, stephen@networkplumber.org, Danylo Vodopianov Subject: [PATCH v1 05/31] net/ntnic: fix realloc memory leak Date: Tue, 21 Jan 2025 18:07:43 +0100 Message-ID: <20250121170814.3252171-6-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20250121170814.3252171-1-sil-plv@napatech.com> References: <20250121170814.3252171-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C70A:EE_|DBAP190MB0854:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8ac359d7-693e-43c2-854d-08dd3a3e3837 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hOJA8XED1bzXTVJZYmpRh7J+T4aKMH2d85yMUgen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MHorAKyVxOZPyEB7t2TgR2uFMt9KPQ/Y1SBu5KM8/0XR+fw2Q?= =?us-ascii?Q?TKOA3bD8Svia9VPxnbMGSDL3f4aSFg546+cluQ+HeWILCW47BKt1MgKpJTOY?= =?us-ascii?Q?yVT0O9va/kNGgonXJXr2HlqOzyBH6LXmHHjJSkqn7T+eeQLtPadUabXyciZ2?= =?us-ascii?Q?KmiI3VTtaXTonwQxWVJTUEJHIgqF2mRRlKRDhd8fMqxJWkIyP27c0y6ukTrs?= =?us-ascii?Q?xLiqUWKm+GqwOq7rf7rDqJ2BYaemJlmyXWjhVBzgIYxzIR40CLeZvwCWZMI2?= =?us-ascii?Q?hOiN+6pdxLwGIwfPovh5tmgdSVZeLFnlVRO+UT8i8l4nYmi0vgFLjhFsoArC?= =?us-ascii?Q?dy+BTqrnY+zdL5xoEayDlJAAkMd1NVy9y8CcyEIu1CqgT9Kb6OYugggwQYQN?= =?us-ascii?Q?U2Qf/dj/i5sYp8LdBRtN8b11tZA1cYYhl4QuT4Lv3Yjjg6TX17/fKU33D6Lg?= =?us-ascii?Q?ZtdXbqw8KATVCNfjSbeUS0JqnZ7I14WL6z+1plrnEs8iByAdI0yWxuJHvQGL?= =?us-ascii?Q?nwl4/YJs9IBQrvdRjCpZV5h3J2Za30wMLAirIQCCswJn5e9N7alfhK48iK8H?= =?us-ascii?Q?65nZaJDr2r1gO6c=3D?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 0q1UX6/63HCaWkos8zN0JeMhyFu6PbyYEnHho/yr0iAYxIXWhdKgUItTTj3Eu1CCxuJ+CbaqZbgAyfpbisNVdMl7S6SPl4aOPQ9jabzUKojOOXDC2rnKsaBNsWKe7GB353dREWzxVO1zwOfDHg5Dla1/5c2ZyzVA/s4gXiUdwaGa+N1FiC7eaNlb0grAFcvmu4RGymz0M1RC3uUipJp/y9Z36VxDbHu9mYDHhpvLRw6BlrtXcKgE7ZrlPiJzzioMAED+euhMeAS2sHSN4qvL2Td2rPlCsmduR9K0Eg48XvI6nHiHgZdvNB6bqS/TJuXsn3Sllt3Kjy7Z/F6OK5rpGbGgoxRoYSvyxEhLmGe7SCPAJR4QaBe+c4YuElJEx4EMQ3pT3kCgPmXjc35aPAoxb+2niakxTL2UDBLwvn/2e/X9yMrvhR0zwHTsucXN0d622ZkFJqbPENYbCKcUDgp2EGIIA7WcCQkToklFgIMaoLmpu3itE+fNuIPtqmV7jARr2ZWfDeZDFZistXX0RSLMj+pOqfswlXN9X4x1jGz6SNK+y+NJCTCZLWipkvAp4VqjaCD9lHLxAja4fsPplsQzmsdt76NCQjQrgknlHbWeOUqiJpJf7DW5LCcH/0iS/Y1gq2ZOE5D5OnHJuSkCvRaV9g== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2025 17:08:26.0774 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ac359d7-693e-43c2-854d-08dd3a3e3837 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C70A.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAP190MB0854 X-BESS-ID: 1737479307-302816-13351-7964-1 X-BESS-VER: 2019.1_20250117.1903 X-BESS-Apparent-Source-IP: 104.47.11.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoamppZAVgZQMCXF1NLE3CDZLM 08JTnNKM0syTLVxCjRJNko0SA50dxCqTYWAI+ihkxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261957 [from cloudscan12-152.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 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 From: Danylo Vodopianov Issue was fixed with verification in case of the successful memory re-allocation. Coverity issue: 448959 Fixes: 4033e0539435 ("net/ntnic: add flow meter") Signed-off-by: Danylo Vodopianov --- .../profile_inline/flow_api_profile_inline.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index ff8eb502f4..1c7d5cac3e 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -5523,11 +5523,16 @@ int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id, struct flm_flow_mtr_handle_s *mtr_handle = dev->ndev->flm_mtr_handle; if (mtr_handle->port_stats[caller_id]->shared == 1) { - res = realloc(mtr_handle->port_stats[caller_id]->stats, - port_attr->nb_meters) == NULL - ? -1 - : 0; - mtr_handle->port_stats[caller_id]->size = port_attr->nb_meters; + struct flm_mtr_stat_s *temp_stats = + realloc(mtr_handle->port_stats[caller_id]->stats, + port_attr->nb_meters); + if (temp_stats == NULL) { + res = -1; + } else { + res = 0; + mtr_handle->port_stats[caller_id]->stats = temp_stats; + mtr_handle->port_stats[caller_id]->size = port_attr->nb_meters; + } } else { mtr_handle->port_stats[caller_id] = -- 2.45.0