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 C311D45B17 for ; Sat, 12 Oct 2024 04:42:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7257F4065C; Sat, 12 Oct 2024 04:42:03 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2122.outbound.protection.outlook.com [40.107.100.122]) by mails.dpdk.org (Postfix) with ESMTP id A52A94065C; Sat, 12 Oct 2024 04:42:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YP5pUgqP45NDskG7BG8mBPt//SETz3cixfILVqdRREKHlE+4Yxil6XG3lPdLuaEfiodJpEI7Z11DQBXSi7Qus/PCL4W2QJaOVSk3+nq2xaf2tV+dqTwmUlBqU2HPrSShv5MpPndx1EHrXbf6QLfc2uehH4VvGvNVhMHvX2lM9riVxWGE5EO78x+Z2HfqgXaza/hkr8fnErMvtT24C3ZJd/wj8vfFqLVsk/E8dnWD3lW3rwzh9eDpKEr1S6WCvEgoIROwRgEg1pLUty5A9AtNylonSg5pBZM98gaJ61bXyycEvnAB+GujEfbi/4OFwxO5WaV5NTFluFDhUXluhRDxFw== 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=W1wxfvMOxzvf2LlkoqWnZkB+wF6yag1NF5A9V8odzQY=; b=uUegNBzx3ensfn9tKr940GMyySIKoDRr/0wyd5F+zc35y17M5cGvVinO7U4s9Y5dFXsO8stMK1flHiOzc7++eoiXa1jZj6bYSUqjYM7woWmePbsGQe4neVXutotz23ArK/pXSVssZjMCUKLg1PwEUgzODDSVI+2F/cJ6Xy6SuEozcsxlv2gCq2LYi5YfvoVGKU7ySXQDRXa/mUJkp+MWcyrfRF4GpCixRyLP8kzschm9iQcWd3zoECwaXfOX2Sv0p5oDJXx5odk06lNmyxC4KZ4EyQflwey45tPzj0iL8D3DYLnj1MeeMOtmeTH00UvEdIfiokORI7Rx8QXa0hrM3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W1wxfvMOxzvf2LlkoqWnZkB+wF6yag1NF5A9V8odzQY=; b=lgeZmFXPzq2OipT1fIItPhjS+yDeaJWUp6gfb9BJ2ovzpUut6IEAhb09R+McSKgVmmYusppNXUINeOf83tPV+1zEkSxpnthLYfQYeI3S8zILlc3C2QdWLBNyZbOHP22Fd6ZlfCX/0Ebw8lok6/qFMDtc3i7059jUE7+85dWfj+I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CO1PR13MB4902.namprd13.prod.outlook.com (2603:10b6:303:f0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.21; Sat, 12 Oct 2024 02:42:01 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%5]) with mapi id 15.20.8048.017; Sat, 12 Oct 2024 02:42:01 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Chaoyong He , stable@dpdk.org, Long Wu , Peng Zhang , Stephen Hemminger Subject: [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic Date: Sat, 12 Oct 2024 10:41:07 +0800 Message-Id: <20241012024107.3795935-11-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20241012024107.3795935-1-chaoyong.he@corigine.com> References: <20241010091716.3631747-1-chaoyong.he@corigine.com> <20241012024107.3795935-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR06CA0001.apcprd06.prod.outlook.com (2603:1096:4:186::21) To PH0PR13MB5568.namprd13.prod.outlook.com (2603:10b6:510:12b::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO1PR13MB4902:EE_ X-MS-Office365-Filtering-Correlation-Id: e287b708-bb73-42d4-2b1c-08dcea6772d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|366016|52116014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Fc9QkZnJfdfJi8cDVbXqSYGCingVqL1tVmK445VpcAq8lO4RP6kJD22xzSxJ?= =?us-ascii?Q?Al6ULaf2rFrgfhMIRUZYw3C1nqVNHq4I4IgaEBnEbdXnZNNaNixUWyBGVn61?= =?us-ascii?Q?C28KwF+e43iQqUbQTTmavVftc7kgHr5mwEDRw9BHDx5T7mebJx2xEvHiIwdA?= =?us-ascii?Q?+Zb2xluqDsntQ7fR3LG8boBg4FFurJYfa6rqkL/4NxhJhO40f3rpVXpTdG1v?= =?us-ascii?Q?+zuo8m1p1K2TeSFqVPGPqIYdsFHfb4CYAsdfP+ZAtwEYLYIMtgynrZLFOkFR?= =?us-ascii?Q?osFjjiYxz9ZoFhpp7QTf47qohEL98mFLlEpG8w7s37XRa9mPmNwUybqD6qBI?= =?us-ascii?Q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mXJFFqeB53EcIM?= =?us-ascii?Q?1UHS0TMRnQlt0mkJ2QaR2p6cTypkP6/OyTKpjM8T9P5RP9z45mC1q1d5vvlV?= =?us-ascii?Q?qXcjqm14Og23rpImZLPUmTg3We7lkCI2FMn+gvz3LJPTkw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(52116014)(1800799024)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ltaMkfAQCd0ExwdMoKWz4vGiQudkmYrXXWWyuIBNANZWMYsHGZr+Fpqu6/m4?= =?us-ascii?Q?zydDmxGcWUNWxwzJqLs2YokPZPuXA85JYIMne3ga+GPTyAjQUQ0ej6YyqoEc?= =?us-ascii?Q?jNmIiyZA/6fRnM0fCd/uDFMvI8AAYwqvJpL0D8nVDvxsjzS5IN6bM1IYnNLF?= =?us-ascii?Q?UAetx4Gx3bHciq24wR/6JWJZ2yq9GknhPi9UKmtnWpSh8XyVrtS5luy4HG5L?= =?us-ascii?Q?HkkwQv2/+FHm/Y0oN38r10pv5KFp3bMzZs2EYc+/Fq5EWEYB9Kq/KP1rD8OU?= =?us-ascii?Q?KYlrscv+bldhJV2Etk7/swmCGINKV23fu926JZry1VZXf5wPFibCjLyTpN/X?= =?us-ascii?Q?VYo9YJdZHS7KY/m6akdn6cqkWv681TTQQ+VgBrJ2OEgTqgCDfEU04UrikK6+?= =?us-ascii?Q?XvbxMjq3ydlMMuz4Qiue9bGd0AVb1BLE22Ehan2Sb0sKw6yCtFJy+6XWVFAV?= =?us-ascii?Q?9l//eKLEnzSXBm0hukZpRTOEdvMvtNA5GlhE7RKYGGdwSIipXgSY/5jdjN8x?= =?us-ascii?Q?HYda5p3qh62l8aCNs0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rk8+yhTqw?= =?us-ascii?Q?PuiWjs67RdH3olR8N9J0hnnWzd1X2nl3FvssrjqdMv5FIR/SyBtKfWl/+dKK?= =?us-ascii?Q?Mpq5hu+izsuB1i9w9oAvkBRsuySH+fHvOe0BLX15LstxRtnx/FDx/y5brxej?= =?us-ascii?Q?U/b4cXFZKGzWheMUGWH2Ifb2EC8RQ4wh4tap1Ma9X+/TpUx78xDAYq6K4qV5?= =?us-ascii?Q?7w=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: e287b708-bb73-42d4-2b1c-08dcea6772d7 X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB5568.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2024 02:42:01.3755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HKEZp+kFtJetfb7ucRg6DtKN3oxIak/lDyzoCvBdPPK69yYi+ulP91FPBwqcRMHzW3q1nKqPBqPpyuYHBqSJGGCjpOrs8naF01FTYoByMmE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR13MB4902 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Fix one memory leak problem in the logic of VF initialization. Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data") Cc: stable@dpdk.org Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang Acked-by: Stephen Hemminger --- drivers/net/nfp/nfp_ethdev_vf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c index ab413a2c5a..0aadca9010 100644 --- a/drivers/net/nfp/nfp_ethdev_vf.c +++ b/drivers/net/nfp/nfp_ethdev_vf.c @@ -322,12 +322,13 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat", - sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0); + net_hw->eth_xstats_base = rte_calloc("rte_eth_xstat", + nfp_net_xstats_size(eth_dev), sizeof(struct rte_eth_xstat), 0); if (net_hw->eth_xstats_base == NULL) { PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!", pci_dev->device.name); - return -ENOMEM; + err = -ENOMEM; + goto hw_priv_free; } /* Work out where in the BAR the queues start. */ -- 2.39.1