From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id A0579200; Mon, 16 Jul 2018 18:04:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 09:04:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,361,1526367600"; d="scan'208";a="67354994" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.223]) by orsmga003.jf.intel.com with ESMTP; 16 Jul 2018 09:03:58 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org Date: Mon, 16 Jul 2018 17:03:47 +0100 Message-Id: <20180716160347.35376-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] examples/exception_path: fix possible out-of-bounds read X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2018 16:04:15 -0000 When printing out stats from the exception_path app, all possible lcore_ids are iterated. However, the app only supports up to 64 cores. To prevent possible errors, and to remove coverity warnings, explicitly check for out-of-range lcore ids before printing. Coverity issue: 268335 Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- examples/exception_path/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 0b59f6b3f..440422bc8 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -131,6 +131,9 @@ print_stats(void) " Lcore Port RX TX Dropped on TX\n" "------- ------ ------------ ------------ ---------------\n"); RTE_LCORE_FOREACH(i) { + /* limit ourselves to application supported cores only */ + if (i >= APP_MAX_LCORE) + break; printf("%6u %7u %13"PRIu64" %13"PRIu64" %16"PRIu64"\n", i, (unsigned)port_ids[i], lcore_stats[i].rx, lcore_stats[i].tx, -- 2.17.1