All of lore.kernel.org
 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 v1] examples/vm_power_manager: fix buffer overrun
Date: Wed, 10 Apr 2019 13:49:10 +0100	[thread overview]
Message-ID: <20190410124910.24537-1-david.hunt@intel.com> (raw)

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 <david.hunt@intel.com>
---
 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


             reply	other threads:[~2019-04-10 12:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 12:49 David Hunt [this message]
2019-04-18 15:14 ` [dpdk-dev] [PATCH v1] examples/vm_power_manager: fix buffer overrun Pattan, Reshma
2019-04-23 10:26   ` Kevin Traynor
2019-04-23 10:31     ` Hunt, David
2019-04-23 10:42       ` Kevin Traynor
2019-04-22 21:54 ` Thomas Monjalon
2019-04-23  8:21   ` Hunt, David
2019-04-23  8:33     ` Thomas Monjalon
2019-04-23  8:35       ` Hunt, David
2019-04-23  8:53 ` [dpdk-dev] [PATCH v2] " David Hunt
2019-04-26  8:42   ` [dpdk-dev] [PATCH v3] " David Hunt
2019-05-02 23:38     ` [dpdk-dev] [dpdk-stable] " 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=20190410124910.24537-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.