From 0e862fabcc4772ec8f98c60ed3ddd004f785b6ce Mon Sep 17 00:00:00 2001 From: "Chen,Yugang" Date: Fri, 6 Sep 2019 11:03:05 +0800 Subject: Static code analysis scan issue fix Fix the issues found during code static scan Tested: test in board, function works fine. 1. busctl set-property for watchdog, it works fine. 2. It works by running "ipmitool chassis power soft". 3. run "ipmitool raw 0x6 0x46 1", get expected user information. Change-Id: I7a2cc3c934db6a7531f8a8ea05956cb6d6337633 Signed-off-by: Chen,Yugang --- app/watchdog_service.cpp | 3 ++- host-interface.cpp | 2 +- user_channel/user_mgmt.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp index c567ca9..0eedf1b 100644 --- a/app/watchdog_service.cpp +++ b/app/watchdog_service.cpp @@ -153,7 +153,8 @@ void WatchdogService::setProperty(const std::string& key, const T& val) if (wasValid) { // Retry the request once in case the cached service was stale - return setProperty(key, val); + setProperty(key, val); + return; } log("WatchdogService: Method error setting property", entry("PROPERTY=%s", key.c_str())); diff --git a/host-interface.cpp b/host-interface.cpp index 69ab376..1f9bfcb 100644 --- a/host-interface.cpp +++ b/host-interface.cpp @@ -54,7 +54,7 @@ void Host::execute(Base::Host::Command command) std::placeholders::_1, std::placeholders::_2)); - return ipmid_send_cmd_to_host(std::move(cmd)); + ipmid_send_cmd_to_host(std::move(cmd)); } // Called into by Command Manager diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp index bf43f88..d0dcb38 100644 --- a/user_channel/user_mgmt.cpp +++ b/user_channel/user_mgmt.cpp @@ -1635,7 +1635,7 @@ void UserAccess::initUserDataFile() auto usrObj = managedObjs.find(usersPath); if (usrObj != managedObjs.end()) { - bool usrEnabled; + bool usrEnabled = false; // User exist. Lets check and update other fileds getUserObjProperties(usrObj->second, usrGrps, usrPriv, @@ -1692,7 +1692,7 @@ void UserAccess::initUserDataFile() { std::vector usrGrps; std::string usrPriv, userName; - bool usrEnabled; + bool usrEnabled = false; std::string usrObjPath = std::string(usrObj.first); if (getUserNameFromPath(usrObj.first.str, userName) != 0) { -- cgit v1.2.1