From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 47EB8A0096 for ; Wed, 10 Apr 2019 14:49:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE3121B116; Wed, 10 Apr 2019 14:49:19 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C63165F32; Wed, 10 Apr 2019 14:49:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 05:49:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="133069605" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.223.64]) by orsmga008.jf.intel.com with ESMTP; 10 Apr 2019 05:49:12 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, stable@dpdk.org Date: Wed, 10 Apr 2019 13:49:10 +0100 Message-Id: <20190410124910.24537-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH v1] examples/vm_power_manager: fix buffer overrun X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The freqs array in freq_info struct has RTE_MAX_LCORE_FREQS elements, yet the code can attemtp to look at the index at POWER_MANAGER_MAX_CPUS, which may be greater than RTE_MAX_LCORE_FREQS. Fix to limit index to RTE_MAX_LCORE_FREQS. Fixes: d26c18c93260 ("examples/vm_power: cpu frequency in host") Coverity issue: 337660 Signed-off-by: David Hunt --- examples/vm_power_manager/power_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index aef832644..35be30d2e 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -143,7 +143,7 @@ power_manager_get_current_frequency(unsigned core_num) rte_spinlock_lock(&global_core_freq_info[core_num].power_sl); index = rte_power_get_freq(core_num); rte_spinlock_unlock(&global_core_freq_info[core_num].power_sl); - if (index >= POWER_MGR_MAX_CPUS) + if (index >= RTE_MAX_LCORE_FREQS) freq = 0; else freq = global_core_freq_info[core_num].freqs[index]; -- 2.17.1