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 B72A842CDA; Fri, 16 Jun 2023 14:41:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A911A42B71; Fri, 16 Jun 2023 14:41:39 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2051.outbound.protection.outlook.com [40.107.220.51]) by mails.dpdk.org (Postfix) with ESMTP id 16DF840DDB for ; Fri, 16 Jun 2023 14:41:39 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ch88Pr/Gn36XQRMYEzBceq/Q2LY6SIk/xbYvQYC5OdyqwhjCGYQ3jo1fip8SCB/KzsRVlhCCB5q72wv5UrbjZT9dtrgeyky8oJVfSOl9tpHpyaGUe5j+iNM9esR4FB6N2tHSZS6CVp0zeMH23UUE4xHHBthWI+B4w5HA4xr1RHJaseQ7oI9Fwy8VDHZWGsDDhkuVQKUbM+LecD5nCcJfkWYm+rO6BcBKDbO3h34LEummNWwaJY5Y0daJ+6kCUuqF7yviLEVCP+xid624iMNiQ/LQ/K3k3UxfldiqMPmmibWflOOqteLm6RwAQjg0h4qjLhYHYNCcbrJspJ8USKZeQA== 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=pKW1ALHu+rN1q26AGFy1T6UTXYTUne+kDZl7GPMDeIw=; b=kzHOWMyIAfQT9m66Bm4uQtroj0kFmKCaHMvgEJPNjErK0zxEPNYQy0FXPwXhv5K2OPveO02XAHkUijiGaIeFzZtjuImVWbhA2MKrD5RUQSmFgYVbQ1vcrlZfU9g40PbRYzdVv9zF2+RDi1cchuctO3frmd7s9EDlcZ0CVUGPkgi4bDEj58ngUEBNVoQZzaAkYOzdOwehKROH2XlgxiC1JKxu62LPdtSUPXVlN+YVCN1+1iCEqtEUDUya4eXiak+2NPswv1mNdya1E2Q7ZG8VlDoCizJV3qJ2f5gtw/E0/iuGkxPeIRiivIQW5P8JLdAOqBDd+ibQ7KFKbzJe799dtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pKW1ALHu+rN1q26AGFy1T6UTXYTUne+kDZl7GPMDeIw=; b=UKEiFxkNWjoyoajG6Hv+rAIxwcB6Ifs3CHD34OsClP0kNk4xCLFA4rZre1UPZpS5ilsHaXQEL/B5NSo+Z34dXk5oC4dklwiOTNl6CNKwYUKnJdjq0c+FZiqw1g6zZEctaSpLtr6etJEvQ90Y9La+9NRuVbRsiyHo4vOoMuAPdI0= Received: from MW2PR16CA0060.namprd16.prod.outlook.com (2603:10b6:907:1::37) by BY5PR12MB4321.namprd12.prod.outlook.com (2603:10b6:a03:204::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.27; Fri, 16 Jun 2023 12:41:36 +0000 Received: from CO1NAM11FT031.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::99) by MW2PR16CA0060.outlook.office365.com (2603:10b6:907:1::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.27 via Frontend Transport; Fri, 16 Jun 2023 12:41:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT031.mail.protection.outlook.com (10.13.174.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.29 via Frontend Transport; Fri, 16 Jun 2023 12:41:36 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 16 Jun 2023 07:41:34 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 16 Jun 2023 07:41:29 -0500 Received: from xhdipdslab59.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 16 Jun 2023 07:41:27 -0500 From: Abhijit Gangurde To: , CC: , , , Abhijit Gangurde Subject: [PATCH v2 2/3] bus/cdx: move debug print before unmapping resource Date: Fri, 16 Jun 2023 18:09:09 +0530 Message-ID: <20230616123910.1110724-3-abhijit.gangurde@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230616123910.1110724-1-abhijit.gangurde@amd.com> References: <20230616123910.1110724-1-abhijit.gangurde@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT031:EE_|BY5PR12MB4321:EE_ X-MS-Office365-Filtering-Correlation-Id: d3507bf9-7a39-42af-650e-08db6e6705d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PxPUMrF4Ankxzz63sbusF3p5oREja6eCr3dc/VixZvoeSfKyJRAnTXSkxDpb2exZ6Du+hn5vV6yeZ2W8tFoo6ykZ8plaH6Tv9UC2zHvpMvi/UkN9wXbaOkSsq8hdTRg5r/CUMtD2TpL2pU3t7i6gim3Hq8EvdpEl6mV/03h1v18IpzLj3ypLfiX32l5Delou7yCWIf5OJ8WO8NI7dKf4qVO0hgu/CP2tPiI0++TXoLgUGnYZfwbr5dfBk3OPT/F+cdMoQS9kCje+Fj3/5bs/aczpTdNJzPCJ73YXiBppSSrSKeSv2OLJflhmPzQw9KKLHyb8q6M7rcU9K+fayPZUT2Y/AFZNKlxAozjbuMtF1AwGzvd+qL2Fgzi8+D/0/PMgMSOqN6RXJMyj8o+jTzOAQqZ4yvniJB4zPVpXZx64ZYUILJCg4CD4sfw03rspezc6DFnspYE0DlLSv5yeh1u2buYkAg1TMn8L4KP5bg25klSKc7prHv+5BlbnVwNfENG0tPup3k4KqWQTvZDCs1Ui7Nwiwku2nuIBDVKTIxRMK3KHCFcy/RxL+3LaBUfXRJZqFNJwohrRNd7hv+hUKY3MFglM6PIHMb5Ju70YDRBx3uBlABopNsvMteD52ZtRonY0CM/sHcrklvvsr5b8Zr1TJMeCeGU6gZlY1Uq75OJSYC+c68BEAPjCsudI9+3vPtYmH+i9E3fpqteCID4EC6gr0ftycoZckgs6Q38RraWnHIJ6KNxoS/MTZMp+VVbD1fvPlBJdQDrfdrPM++RP5PrAsg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(136003)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(36756003)(82310400005)(86362001)(478600001)(8676002)(8936002)(41300700001)(81166007)(82740400003)(6636002)(4326008)(110136005)(54906003)(6666004)(316002)(5660300002)(44832011)(1076003)(186003)(26005)(2906002)(36860700001)(2616005)(47076005)(40480700001)(356005)(70586007)(70206006)(426003)(83380400001)(40460700003)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2023 12:41:36.0027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3507bf9-7a39-42af-650e-08db6e6705d7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT031.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4321 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 Move debug print before unmapping requested address to fix use after free coverity issue. Coverity issue: 385381 Fixes: 45ef232af515 ("bus/cdx: introduce AMD CDX bus") Signed-off-by: Abhijit Gangurde --- v2: - Updated commit message drivers/bus/cdx/cdx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/cdx/cdx.c b/drivers/bus/cdx/cdx.c index 9130c30515..aef19682f4 100644 --- a/drivers/bus/cdx/cdx.c +++ b/drivers/bus/cdx/cdx.c @@ -322,12 +322,13 @@ cdx_unmap_resource(void *requested_addr, size_t size) if (requested_addr == NULL) return; + CDX_BUS_DEBUG("Unmapping CDX memory at %p", requested_addr); + /* Unmap the CDX memory resource of device */ if (rte_mem_unmap(requested_addr, size)) { CDX_BUS_ERR("%s(): cannot mem unmap(%p, %#zx): %s", __func__, requested_addr, size, rte_strerror(rte_errno)); } - CDX_BUS_DEBUG("CDX memory unmapped at %p", requested_addr); } /* * Match the CDX Driver and Device using device id and vendor id. -- 2.25.1