From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helin Zhang Subject: [PATCH v2 3/3] i40e: fix the overflow issue Date: Mon, 7 Mar 2016 16:12:50 +0800 Message-ID: <1457338370-32744-4-git-send-email-helin.zhang@intel.com> References: <1453426623-8696-1-git-send-email-helin.zhang@intel.com> <1457338370-32744-1-git-send-email-helin.zhang@intel.com> To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5C4002C67 for ; Mon, 7 Mar 2016 09:13:05 +0100 (CET) In-Reply-To: <1457338370-32744-1-git-send-email-helin.zhang@intel.com> 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" The array 'ptype_table' was defined in depth of 'UINT8_MAX' which is 255, while the querying index could be from 0 to 255. The issue can be fixed with expanding the array to one more element. Fixes: 9571ea028489 ("i40e: replace some offload flags with unified packet type") Signed-off-by: Helin Zhang --- drivers/net/i40e/i40e_rxtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index d5c4031..ac44901 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -198,7 +198,7 @@ i40e_get_iee15888_flags(struct rte_mbuf *mb, uint64_t qword) static inline uint32_t i40e_rxd_pkt_type_mapping(uint8_t ptype) { - static const uint32_t ptype_table[UINT8_MAX] __rte_cache_aligned = { + static const uint32_t type_table[UINT8_MAX + 1] __rte_cache_aligned = { /* L2 types */ /* [0] reserved */ [1] = RTE_PTYPE_L2_ETHER, @@ -724,7 +724,7 @@ i40e_rxd_pkt_type_mapping(uint8_t ptype) /* All others reserved */ }; - return ptype_table[ptype]; + return type_table[ptype]; } #define I40E_RX_DESC_EXT_STATUS_FLEXBH_MASK 0x03 -- 2.5.0