Skip to content

Commit

Permalink
examples/power: fix buffer overrun
Browse files Browse the repository at this point in the history
[ upstream commit 3f1fc5f ]

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.

Coverity issue: 337660
Fixes: d26c18c ("examples/vm_power: cpu frequency in host")

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
  • Loading branch information
climberhunt authored and kevintraynor committed May 8, 2019
1 parent c35f7d9 commit 695d45d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/vm_power_manager/power_manager.c
Expand Up @@ -157,7 +157,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];
Expand Down

0 comments on commit 695d45d

Please sign in to comment.