From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Qiu Subject: [PATCH] testpmd: Fix segment fault when port ID greater than 76 Date: Wed, 29 Jul 2015 02:32:15 +0800 Message-ID: <1438108335-10093-1-git-send-email-michael.qiu@intel.com> To: dev@dpdk.org Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 527B8C4FA for ; Tue, 28 Jul 2015 20:32:23 +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" In testpmd, when using "rx_vlan add 1 77", it will be a segment fault Because the port ID should be less than 32. Signed-off-by: Michael Qiu --- app/test-pmd/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1d29146..cf2aa6e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -388,7 +388,7 @@ port_id_is_invalid(portid_t port_id, enum print_warning warning) if (port_id == (portid_t)RTE_PORT_ALL) return 0; - if (ports[port_id].enabled) + if (port_id < RTE_MAX_ETHPORTS && ports[port_id].enabled) return 0; if (warning == ENABLED_WARN) -- 1.9.3