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 D255DA05D3 for ; Fri, 26 Apr 2019 10:42:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8AFE97D52; Fri, 26 Apr 2019 10:42:17 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7058A7D52; Fri, 26 Apr 2019 10:42:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 01:42:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,396,1549958400"; d="scan'208";a="165046958" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.223.64]) by fmsmga002.fm.intel.com with ESMTP; 26 Apr 2019 01:42:11 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, stable@dpdk.org Date: Fri, 26 Apr 2019 09:42:09 +0100 Message-Id: <20190426084209.3853-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190423085344.3493-1-david.hunt@intel.com> References: <20190423085344.3493-1-david.hunt@intel.com> Subject: [dpdk-stable] [PATCH v3] 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 attempt to look at the index at RTE_MAX_LCORE, 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 CC: stable@dpdk.org Signed-off-by: David Hunt Acked-by: Reshma Pattan --- v2 - Rebase to 19.05 RC2. v3 - add CC stable --- 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 9553455be..9d4e587b0 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 >= RTE_MAX_LCORE) + if (index >= RTE_MAX_LCORE_FREQS) freq = 0; else freq = global_core_freq_info[core_num].freqs[index]; -- 2.17.1