lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241104090351.1352997-1-ruanjinjie@huawei.com>
Date: Mon, 4 Nov 2024 17:03:51 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <rafael@...nel.org>, <pavel@....cz>, <len.brown@...el.com>,
	<daniel.lezcano@...aro.org>, <qperret@...gle.com>, <lukasz.luba@....com>,
	<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH] PM: EM: Fix uninitialized power in em_create_perf_table

In em_create_perf_table(), power is uninitialized and passed the pointer
to active_power() hook, but the hook function may not assign it and
return 0, such as mtk_cpufreq_get_cpu_power(), so the later zero check for
power is not invalid, initialize power to zero to fix it.

Cc: stable@...r.kernel.org
Fixes: 7d9895c7fbfc ("PM / EM: introduce em_dev_register_perf_domain function")
Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
 kernel/power/energy_model.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 927cc55ba0b3..866a3e9c05b2 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -344,7 +344,7 @@ static int em_create_perf_table(struct device *dev, struct em_perf_domain *pd,
 				struct em_data_callback *cb,
 				unsigned long flags)
 {
-	unsigned long power, freq, prev_freq = 0;
+	unsigned long power = 0, freq, prev_freq = 0;
 	int nr_states = pd->nr_perf_states;
 	int i, ret;
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ