power: check frequencies count before filling array
authorRichael Zhuang <richael.zhuang@arm.com>
Fri, 23 Jul 2021 02:22:42 +0000 (10:22 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 24 Jul 2021 08:09:58 +0000 (10:09 +0200)
commitd37462e56ceee7eaf6321ab42c4d2558708183c1
tree1df17b118940b3dcde6e573bd2b98029bcea9940
parent128c22b9980fd032629f46fa15ec6a2024ced399
power: check frequencies count before filling array

The freqs array size is RTE_MAX_LCORE_FREQS. Before filling the
array with num_freqs elements, restrict the total num to
RTE_MAX_LCORE_FREQS. This fix aims to fix the coverity scan issue
like:
Overrunning array "pi->freqs" of 256 bytes by passing it to a
function which accesses it at byte offset 464.

Coverity issue: 371913
Fixes: ef1cc88f1837 ("power: support cppc_cpufreq driver")
Cc: stable@dpdk.org
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Acked-by: David Hunt <david.hunt@intel.com>
lib/power/power_cppc_cpufreq.c
lib/power/power_pstate_cpufreq.c