DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v3] examples/vm_power_manager: fix buffer overrun
Date: Fri, 26 Apr 2019 09:42:09 +0100	[thread overview]
Message-ID: <20190426084209.3853-1-david.hunt@intel.com> (raw)
In-Reply-To: <20190423085344.3493-1-david.hunt@intel.com>

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 <david.hunt@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>

---
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

  parent reply	other threads:[~2019-04-26  8:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 12:49 [dpdk-dev] [PATCH v1] " David Hunt
2019-04-10 12:49 ` David Hunt
2019-04-18 15:14 ` Pattan, Reshma
2019-04-18 15:14   ` Pattan, Reshma
2019-04-23 10:26   ` Kevin Traynor
2019-04-23 10:26     ` Kevin Traynor
2019-04-23 10:31     ` Hunt, David
2019-04-23 10:31       ` Hunt, David
2019-04-23 10:42       ` Kevin Traynor
2019-04-23 10:42         ` Kevin Traynor
2019-04-22 21:54 ` Thomas Monjalon
2019-04-22 21:54   ` Thomas Monjalon
2019-04-23  8:21   ` Hunt, David
2019-04-23  8:21     ` Hunt, David
2019-04-23  8:33     ` Thomas Monjalon
2019-04-23  8:33       ` Thomas Monjalon
2019-04-23  8:35       ` Hunt, David
2019-04-23  8:35         ` Hunt, David
2019-04-23  8:53 ` [dpdk-dev] [PATCH v2] " David Hunt
2019-04-23  8:53   ` David Hunt
2019-04-26  8:42   ` David Hunt [this message]
2019-04-26  8:42     ` [dpdk-dev] [PATCH v3] " David Hunt
2019-05-02 23:38     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2019-05-02 23:38       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190426084209.3853-1-david.hunt@intel.com \
    --to=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).