From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beilei Xing Subject: [PATCH] examples/tep_term: fix out-of-bounds access Date: Tue, 5 Jul 2016 14:15:40 +0800 Message-ID: <1467699340-16448-1-git-send-email-beilei.xing@intel.com> Cc: dev@dpdk.org, Beilei Xing To: jingjing.wu@intel.com, michalx.k.jastrzebski@intel.com Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C566F1DB1 for ; Tue, 5 Jul 2016 08:15:48 +0200 (CEST) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Coverity reported lots of out-of-bounds in function vxlan_link, these issues should happen when index port_id evaluates to 2, cause size of arrays is 2 in structure. Fix this issue by modifying judgement condition, make sure port_id is less than 2. Coverity issue: 107121, 107122, 107123, 107124, 107125 Fixes: 4abe471ed6fc ("examples/tep_term: implement VXLAN processing") Signed-off-by: Beilei Xing --- examples/tep_termination/vxlan_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 37575c2..8f1f15b 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -249,7 +249,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) struct rte_eth_tunnel_filter_conf tunnel_filter_conf; - if (unlikely(portid > VXLAN_N_PORTS)) { + if (unlikely(portid >= VXLAN_N_PORTS)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: Not configuring device," "as already have %d ports for VXLAN.", -- 2.5.0