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 0BF15A05D3 for ; Tue, 23 Apr 2019 10:53:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 914301B4DB; Tue, 23 Apr 2019 10:53:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 8600C1B451; Tue, 23 Apr 2019 10:53:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 01:53:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,385,1549958400"; d="scan'208";a="151587244" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.223.64]) by FMSMGA003.fm.intel.com with ESMTP; 23 Apr 2019 01:53:46 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, stable@dpdk.org Date: Tue, 23 Apr 2019 09:53:44 +0100 Message-Id: <20190423085344.3493-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410124910.24537-1-david.hunt@intel.com> References: <20190410124910.24537-1-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v2] examples/vm_power_manager: fix buffer overrun 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190423085344.EmoF3XRvmH5F-GDXBq1boX2HYcPvNVSZWyfBYSgam5U@z> 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 Signed-off-by: David Hunt Acked-by: Reshma Pattan --- v2 - Rebase to 19.05 RC2. --- 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