From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id C0F937E28 for ; Tue, 16 Dec 2014 17:30:39 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 16 Dec 2014 08:30:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,587,1413270000"; d="scan'208";a="638463513" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 16 Dec 2014 08:30:25 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBGGUO1L008785; Tue, 16 Dec 2014 16:30:24 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id sBGGUOLW022307; Tue, 16 Dec 2014 16:30:24 GMT Received: (from bricha3@localhost) by sivswdev01.ir.intel.com with id sBGGUOA7022302; Tue, 16 Dec 2014 16:30:24 GMT From: Bruce Richardson To: dev@dpdk.org Date: Tue, 16 Dec 2014 16:30:23 +0000 Message-Id: <1418747424-22254-3-git-send-email-bruce.richardson@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1418747424-22254-1-git-send-email-bruce.richardson@intel.com> References: <1418747424-22254-1-git-send-email-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 2/3] ixgbe: prevent array overflow access in vector driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2014 16:30:42 -0000 Switch the order of the conditions in a while loop, so we check the range of "i" against the max, before using it to index into the array. Signed-off-by: Bruce Richardson --- lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c index 3a30fa7..b54cb19 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c @@ -489,7 +489,7 @@ ixgbe_recv_scattered_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, unsigned i = 0; if (rxq->pkt_first_seg == NULL) { /* find the first split flag, and only reassemble then*/ - while (!split_flags[i] && i < nb_bufs) + while (i < nb_bufs && !split_flags[i]) i++; if (i == nb_bufs) return nb_bufs; -- 1.9.3