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 707664380F; Thu, 4 Jan 2024 03:24:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D818402D8; Thu, 4 Jan 2024 03:24:38 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69]) by mails.dpdk.org (Postfix) with ESMTP id 8B55740266 for ; Thu, 4 Jan 2024 03:24:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQ6u1h+rZASit4IFP1q7E/NwUcc46wh/29Mjhji7lvrP/+8KVEqr63agSj/i/fso85HkJY8ArJkz/Y86Ru8ZB6d/9/N/hrH0ao5K7KV9dXvLAsEdrTd20KLB6Rbzgisggig0Ux4uFsdE7NKmti0WQpeFQn9ijTsMnqOwCQYoU86IC+IhMlnI02B4tb56b8Boslc6IqOFYDrN7OeIcTkc3RQ87Aoe8y137iIRgM2hrLgHL/nxJn9Xy7kM9zlMuM0oZkUbO1S8TN40cvQujau46mcvINx4VjPIUH7+yLTVUdWB34K+rg5asmgW5DdW0xdWQKX/hRq9Rrq+oZpjXzNfDA== 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=Y+aX0k3yBP6yv+yBb/DtRBcO/kWHAtygY0C8mBjn9uo=; b=nOW0P/EA2fMGRV6OtnrV0+RxA/EN6rLZPswAXTTYYl83bvhM8qHo5kTK6py3IyGN/LfNBaf7NrsLccOlU0c7wdziVyecwclJu8Ony50QipHpxMnHl8kmlSWVg01J7ljq5RvKFd9Zl1UFufJQ8JRIrdW9g8GB44l5VwYe3wzW3QeQ+eNPX2GEb/QBQpIpeA5e75b7glndcw0i+Y9PShnqNPQXnvJIyhbJvgBK+XOl9Ue/CvYkeZDt9HkoZ5P5LDD52GtKckVbTAPlibt/ggZmWMNq18VdTx174s8Iu1QYJPGNZgSGI3tQFN4we1RxsklZpOrv8nhrPpy1Jhzw2uC0bQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=marvell.com 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 (0) 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=Y+aX0k3yBP6yv+yBb/DtRBcO/kWHAtygY0C8mBjn9uo=; b=uEBalSV5fC5/ZSxTEZ0TVWcmCxdNT90w6KYav/x1tdDU5d3naUqO+aVmAFzVvUWuQE2Vse5QaFGexzysyWbwbTMMJxOuk4H42scztBon+8Onl8X5ol6tYXdQVlOzMsjuaivG5AiptxrlBx2xhufFhTkXdOuSI55XpB6Vs4wPp446mVUPHtVY1T8NzyXQanbshUg+lIjoOGj2N7nhcwZA61vhasv1V6RuDnYIIbq2jBcq5Z0swr5riIpwg9lDlgd2rJxueWd6rIkPT1bC9zKYAJ73tL5+RzHNPCF4SE91SsLAf9ZFqZmYqbcDRvs3wznyKe38a+1J1iYfnac+1lvaLw== Received: from MW4PR04CA0322.namprd04.prod.outlook.com (2603:10b6:303:82::27) by BY5PR12MB4146.namprd12.prod.outlook.com (2603:10b6:a03:20d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13; Thu, 4 Jan 2024 02:24:34 +0000 Received: from MWH0EPF000989E9.namprd02.prod.outlook.com (2603:10b6:303:82:cafe::2a) by MW4PR04CA0322.outlook.office365.com (2603:10b6:303:82::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25 via Frontend Transport; Thu, 4 Jan 2024 02:24:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MWH0EPF000989E9.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.9 via Frontend Transport; Thu, 4 Jan 2024 02:24:33 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 18:24:22 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 3 Jan 2024 18:24:20 -0800 From: Suanming Mou To: , CC: Subject: [PATCH v2] app/test-crypto-perf: fix invalid mbuf next operation Date: Thu, 4 Jan 2024 10:24:05 +0800 Message-ID: <20240104022405.794338-1-suanmingm@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103035357.720016-1-suanmingm@nvidia.com> References: <20240103035357.720016-1-suanmingm@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E9:EE_|BY5PR12MB4146:EE_ X-MS-Office365-Filtering-Correlation-Id: c0e64704-c594-428c-2361-08dc0ccc4a67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 75mXfCGGIeOVvzctp1N784zK+JdOwnUUJdZ+e8aIg7lOfsxAcjVTS3hPDJDNP1auo8tStcod/+YXMd/x/wlpT4IJqyV8VGXAswZZUtd8n1IiG8Orqwi9VYq+37AIyAlIzY/gWuqqqylruJagw6jjwYKdLcyiJpgiRdwse+Roez5fXEqbIlnbNY+IEdxz/IEUYLO8EEzd7TtZtU6H2MBbxip3tT2tSzZvCoC3cSKk3oVOtP5pwfdAmM+YPXlQxvVMOhL3sh4O0dgBUz4UoZ+xr1Tt0iRFqo3HB5Hhcxu/a0gfgkl0Iwhc48QHOiyWTLEAfk4/eb/ToVNjEDIlD9gchUtieoTkQU28MwUqCHSzzULIobbVUqvmoSeKgq0P5XYmpVLSaiDQ5n8G0RHZgHBPPi6ElseKde03AneLbeoAaYMHUX+Nh4nNCJ7HYtqKQeeuuRaClSucK7nxLXwv4uqJ/uA3F48b2SrHeyreKPzj2kCAokKERqgEySDs0BqY8qkwrduY6hspCfGMGty8Wu9uQHWd5Ncu/PRsSsbHfENq8Mh+FvGgcJmw44R1s1xhuzobryn+bs58SSCotItCaEU6Og2L9GL6Tg9AE2XpD/T6Ad+Lt5jkhk/2Uvlhu4jboDWabbZrTPnFMQEAOtTuX5/V3EEbGWok/4sjuDxFgM4tHs6MwiTbNx6CqRa4dbCCpJIPipkel4eZuAZPvvvlpj/r2om0dqxw67G5oLIeYRxdJwnt8RDtbB7gdJqmewDiTISb X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(376002)(39860400002)(346002)(396003)(136003)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799012)(46966006)(36840700001)(40470700004)(36860700001)(6666004)(82740400003)(7636003)(356005)(7696005)(2906002)(478600001)(70586007)(4326008)(70206006)(110136005)(8676002)(8936002)(316002)(5660300002)(41300700001)(47076005)(16526019)(6286002)(426003)(2616005)(336012)(26005)(1076003)(83380400001)(40460700003)(36756003)(86362001)(40480700001)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2024 02:24:33.9965 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0e64704-c594-428c-2361-08dc0ccc4a67 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4146 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 In fill_multi_seg_mbuf(), when remaining_segments is 0, rte_mbuf m's next should pointer to NULL instead of a new rte_mbuf, that causes setting m->next as NULL out of the while loop to the invalid mbuf. This commit fixes the invalid mbuf next operation. Fixes: bf9d6702eca9 ("app/crypto-perf: use single mempool") Signed-off-by: Suanming Mou --- v2: move next_mbuf inside remaining_segments check. --- app/test-crypto-perf/cperf_test_common.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 932aab16df..b3bf9f67e8 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -49,7 +49,6 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, { uint16_t mbuf_hdr_size = sizeof(struct rte_mbuf); uint16_t remaining_segments = segments_nb; - struct rte_mbuf *next_mbuf; rte_iova_t next_seg_phys_addr = rte_mempool_virt2iova(obj) + mbuf_offset + mbuf_hdr_size; @@ -70,15 +69,15 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, m->nb_segs = segments_nb; m->port = 0xff; rte_mbuf_refcnt_set(m, 1); - next_mbuf = (struct rte_mbuf *) ((uint8_t *) m + - mbuf_hdr_size + segment_sz); - m->next = next_mbuf; - m = next_mbuf; - remaining_segments--; + remaining_segments--; + if (remaining_segments > 0) { + m->next = (struct rte_mbuf *)((uint8_t *) m + mbuf_hdr_size + segment_sz); + m = m->next; + } else { + m->next = NULL; + } } while (remaining_segments > 0); - - m->next = NULL; } static void -- 2.34.1