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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 18 Feb 2019 11:11:40 -0800
From:   Andrey Smirnov <andrew.smirnov@...il.com>
To:     linux-pm@...r.kernel.org
Cc:     Andrey Smirnov <andrew.smirnov@...il.com>,
        Chris Healy <cphealy@...il.com>,
        Lucas Stach <l.stach@...gutronix.de>,
        Zhang Rui <rui.zhang@...el.com>,
        Eduardo Valentin <edubezval@...il.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>, linux-imx@....com,
        linux-kernel@...r.kernel.org
Subject: [PATCH 11/12] thermal: qoriq: Be more strict when parsing "thermal-sensors"

As per Documentation/devicetree/bindings/thermal/qoriq-thermal.txt
thermal-sensor-cells _must_ be 1, so there is no reason to be more
lenient in the code and treat the absence of argument in
thermal-sensors specifier as a valid DT code. Drop that special case
to simplify sensor ID retreival code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
Cc: Chris Healy <cphealy@...il.com>
Cc: Lucas Stach <l.stach@...gutronix.de>
Cc: Zhang Rui <rui.zhang@...el.com>
Cc: Eduardo Valentin <edubezval@...il.com>
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: linux-imx@....com
Cc: linux-pm@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
---
 drivers/thermal/qoriq_thermal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index d4f5e180e1ee..f746c62789b0 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -82,14 +82,14 @@ static int qoriq_tmu_get_sensor_id(void)
 		goto out;
 	}
 
-	if (sensor_specs.args_count >= 1) {
-		id = sensor_specs.args[0];
-		WARN(sensor_specs.args_count > 1,
-				"%pOFn: too many cells in sensor specifier %d\n",
-				sensor_specs.np, sensor_specs.args_count);
-	} else {
-		id = 0;
+	if (sensor_specs.args_count != 1) {
+		pr_err("%pOFn: Invalid number of cells in sensor specifier %d\n",
+		       sensor_specs.np, sensor_specs.args_count);
+		id = -EINVAL;
+		goto out;
 	}
+
+	id = sensor_specs.args[0];
 out:
 	of_node_put(np);
 	of_node_put(sensor_np);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ