From patchwork Wed Sep 7 11:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Morrissey X-Patchwork-Id: 116041 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB75EA054F; Wed, 7 Sep 2022 13:34:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 447B2427EA; Wed, 7 Sep 2022 13:34:05 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 23AC0400D6; Wed, 7 Sep 2022 13:34:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662550443; x=1694086443; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zy7E3nH7bBwPiK3mVJs5EWPSZuPutPIXER9/6RwKkTc=; b=O8e4eTafkH7ssTv86cmBy1n9ueEoC+paPCDWwqPjVzjdTgGV+TJhrnjs DR/HjSK4csAflTaICELHIPF2FGv6EkcY3DOpKOtkC3yHETBwDTjPtrINU 0QA4JhFk9EVBoaEh/tOIjQDzm0eBEb+bVDxptEajS8ZiukVYU0zmjeXIz BVqymX/YMlIxgT8RgcGxPlN7NGBE+lyygGYYOcMY6qeH4IrFOLBgyF6RY Dg3v2lf9MN6abPo1rkAUlNXMpq2iHeo7a0aOfYuk8teqAArUamb0oULor QAzgSo/9RJ78lwT4+H3wKaFtCsi9v6c4Qhi+g/TTRgTfBxwzUUOXFI2EW w==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="294432478" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="294432478" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 04:34:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="676147571" Received: from silpixa00401412.ir.intel.com ([10.243.22.89]) by fmsmga008.fm.intel.com with ESMTP; 07 Sep 2022 04:34:00 -0700 From: Sean Morrissey To: Konstantin Ananyev , Sean Morrissey Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH v1] examples/l3fwd: fix core dump after packet match Date: Wed, 7 Sep 2022 11:33:54 +0000 Message-Id: <20220907113354.1443744-1-sean.morrissey@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 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 This patch fixes a core dump which occurs on 32-bit-builds after sending a matched packet due to overrunning an array. Fixes: 6de0ea50e9b9 ("examples/l3fwd: merge l3fwd-acl example") Cc: sean.morrissey@intel.com Cc: stable@dpdk.org Signed-off-by: Sean Morrissey Acked-by: Vladimir Medvedkin Tested-by: Lingli Chen --- examples/l3fwd/l3fwd_acl_scalar.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/l3fwd/l3fwd_acl_scalar.h b/examples/l3fwd/l3fwd_acl_scalar.h index cd99f8594a..542c303d3b 100644 --- a/examples/l3fwd/l3fwd_acl_scalar.h +++ b/examples/l3fwd/l3fwd_acl_scalar.h @@ -70,15 +70,12 @@ send_packets_single(struct lcore_conf *qconf, struct rte_mbuf *pkts[], uint16_t /* Set MAC addresses. */ eth_hdr = rte_pktmbuf_mtod(pkts[j], struct rte_ether_hdr *); - *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[hops[j]]; - rte_ether_addr_copy(&ports_eth_addr[hops[j]], - ð_hdr->src_addr); - } - - for (j = 0; j != nb_tx; j++) { - if (hops[j] != BAD_PORT) + if (hops[j] != BAD_PORT) { + *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[hops[j]]; + rte_ether_addr_copy(&ports_eth_addr[hops[j]], + ð_hdr->src_addr); send_single_packet(qconf, pkts[j], hops[j]); - else + } else rte_pktmbuf_free(pkts[j]); } }