power: fix frequency list buffer validation

Message ID 20190206121906.4231-1-ktraynor@redhat.com
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series
  • power: fix frequency list buffer validation
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Kevin Traynor Feb. 6, 2019, 12:19 p.m.
The frequency list buffer was already validated in
power_acpi_cpufreq_freqs(), so the newly added check was redundant.
To keep consistency with power_pstate_cpufreq_freqs(), remove the
original check and update the log message.

Fixes: 2e6ccdb4e088 ("power: fix frequency list to handle null buffer")
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 lib/librte_power/power_acpi_cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Monjalon March 29, 2019, 2 p.m. | #1
06/02/2019 13:19, Kevin Traynor:
> The frequency list buffer was already validated in
> power_acpi_cpufreq_freqs(), so the newly added check was redundant.
> To keep consistency with power_pstate_cpufreq_freqs(), remove the
> original check and update the log message.
> 
> Fixes: 2e6ccdb4e088 ("power: fix frequency list to handle null buffer")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>

In absence of review, applied, thanks.

Patch

diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
index 45412f0b9..534efe817 100644
--- a/lib/librte_power/power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -441,6 +441,6 @@  power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 	struct rte_power_info *pi;
 
-	if (lcore_id >= RTE_MAX_LCORE || !freqs) {
-		RTE_LOG(ERR, POWER, "Invalid input parameter\n");
+	if (lcore_id >= RTE_MAX_LCORE) {
+		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
 		return 0;
 	}