Fix for hsbp-manager service crash
When hsbp-manager FRU is corrupted with "Board Mfg" name,
hsbp-manager.service is crashing while extracting Board Mfg from the
FRU and dumping the core.
So add if condition to read when name of the variant contains
exactly string.
Tested:
Verified with corrupted hsbp-manager fru and hsbp-manager.service did
not crash with this change.
Change-Id: Ic279eb1f7c44e7cbbd7313bb9cacb82d9054ff05
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
diff --git a/hsbp-manager/src/hsbp_manager.cpp b/hsbp-manager/src/hsbp_manager.cpp
index 648afd1..1f66558 100644
--- a/hsbp-manager/src/hsbp_manager.cpp
+++ b/hsbp-manager/src/hsbp_manager.cpp
@@ -1699,7 +1699,11 @@
{
continue;
}
- assetInventory[key] = std::get<std::string>(value);
+ if (std::holds_alternative<std::string>(value))
+ {
+ assetInventory[key] =
+ std::get<std::string>(value);
+ }
}
Backplane* parent = nullptr;
@@ -2857,8 +2861,9 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> storageIface;
/* Add interface for storage inventory */
- storageIface = objServer.add_interface("/xyz/openbmc_project/inventory/item/storage/hsbp/1",
- "xyz.openbmc_project.Inventory.Item.Storage");
+ storageIface = objServer.add_interface(
+ "/xyz/openbmc_project/inventory/item/storage/hsbp/1",
+ "xyz.openbmc_project.Inventory.Item.Storage");
storageIface->initialize();