summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorKun Yi <kunyi731@gmail.com>2019-07-10 21:58:32 -0700
committerKun Yi <kunyi731@gmail.com>2019-07-10 21:58:32 -0700
commit6aae76f435209f6324c18f0ba3376ade7f35b848 (patch)
treede3f65365764c043fec703e678b56f65e9f88893 /dbus
parent5e52eab95dc943511c37a3c94a14f7bd0cabec18 (diff)
downloadphosphor-pid-control-6aae76f435209f6324c18f0ba3376ade7f35b848.tar.gz
phosphor-pid-control-6aae76f435209f6324c18f0ba3376ade7f35b848.zip
util: Avoid division by invalid value
Check for max > min before dividing by difference Signed-off-by: Kun Yi <kunyi731@gmail.com> Change-Id: Ic2a983bb6f7c04f1deafcab228b76ff60012f011
Diffstat (limited to 'dbus')
-rw-r--r--dbus/util.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/dbus/util.cpp b/dbus/util.cpp
index 6d5d2c0..33e0985 100644
--- a/dbus/util.cpp
+++ b/dbus/util.cpp
@@ -187,7 +187,7 @@ bool validType(const std::string& type)
void scaleSensorReading(const double min, const double max, double& value)
{
- if (max <= 0)
+ if (max <= 0 || max <= min)
{
return;
}
OpenPOWER on IntegriCloud