From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A090E23B; Wed, 20 Sep 2017 10:07:35 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2017 01:07:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,420,1500966000"; d="scan'208";a="137411558" Received: from unknown (HELO Sent) ([10.103.102.77]) by orsmga002.jf.intel.com with SMTP; 20 Sep 2017 01:07:11 -0700 Received: by Sent (sSMTP sendmail emulation); Wed, 20 Sep 2017 10:05:40 +0200 From: Slawomir Mrozowicz To: john.mcnamara@intel.com Cc: dev@dpdk.org, Slawomir Mrozowicz , ian.betts@intel.com, stable@dpdk.org Date: Wed, 20 Sep 2017 10:05:37 +0200 Message-Id: <1505894737-25596-1-git-send-email-slawomirx.mrozowicz@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples/performance-thread: fix 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: Wed, 20 Sep 2017 08:07:36 -0000 Overrunning array schedcore of 128 8-byte elements at element index 128 using index lcoreid. Fixed by correct check index lcoreid condition. Coverity issue: 143461 Fixes: 116819b9ed0d ("examples/performance-thread: add lthread subsystem") Cc: ian.betts@intel.com Cc: stable@dpdk.org Signed-off-by: Slawomir Mrozowicz --- examples/performance-thread/common/lthread_sched.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/performance-thread/common/lthread_sched.c b/examples/performance-thread/common/lthread_sched.c index 98291478e..138a87d32 100644 --- a/examples/performance-thread/common/lthread_sched.c +++ b/examples/performance-thread/common/lthread_sched.c @@ -578,10 +578,9 @@ int lthread_set_affinity(unsigned lcoreid) struct lthread *lt = THIS_LTHREAD; struct lthread_sched *dest_sched; - if (unlikely(lcoreid > LTHREAD_MAX_LCORES)) + if (unlikely(lcoreid >= LTHREAD_MAX_LCORES)) return POSIX_ERRNO(EINVAL); - DIAG_EVENT(lt, LT_DIAG_LTHREAD_AFFINITY, lcoreid, 0); dest_sched = schedcore[lcoreid]; -- 2.11.0