summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Feist <james.feist@linux.intel.com>2019-06-24 16:18:40 -0700
committerJames Feist <james.feist@linux.intel.com>2019-06-24 16:18:40 -0700
commit11d243dfdd647afe471d650c4408627361f2acf3 (patch)
tree4c7a03f88692978c0a62e593484e3d4daa7b8972
parent10f42efd8b7435d0d1cd4389b22d15ab349bad1a (diff)
downloadphosphor-pid-control-11d243dfdd647afe471d650c4408627361f2acf3.tar.gz
phosphor-pid-control-11d243dfdd647afe471d650c4408627361f2acf3.zip
dbusconfiguration: Protect better against bad config
Configurations with no input are not allowed. The current code looked for if there were any sensors avaiable. On our systems an input was not being displayed due to a bug, but the output was there, causing pid control to crash. Protect against this issue. Tested: Had sensor bug in tree, and pid control didn't segfault Change-Id: I42869748bac0b85affae5f5c671b859fec996a54 Signed-off-by: James Feist <james.feist@linux.intel.com>
-rw-r--r--dbus/dbusconfiguration.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 1fd0d1a..c33264c 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -507,12 +507,6 @@ bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
findSensors(sensors, name, sensorInterfaces);
}
- // if the sensors aren't available in the current state, don't
- // add them to the configuration.
- if (sensorInterfaces.empty())
- {
- continue;
- }
for (const auto& sensorPathIfacePair : sensorInterfaces)
{
@@ -562,6 +556,13 @@ bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
}
}
+ // if the sensors aren't available in the current state, don't
+ // add them to the configuration.
+ if (inputs.empty())
+ {
+ continue;
+ }
+
struct conf::ControllerInfo& info =
conf[std::get<std::string>(base.at("Name"))];
info.inputs = std::move(inputs);
OpenPOWER on IntegriCloud