Fix Klocwork Issue:bitwise operation size mismatch
Bitwise operation on different bit sizes.
Fixed by static_cast to larger integer size.
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
Change-Id: I1f225e487f1b9f3a06fb992aa949fe1a229b5e91
diff --git a/sessions_manager.cpp b/sessions_manager.cpp
index ac20621..13d2ce8 100644
--- a/sessions_manager.cpp
+++ b/sessions_manager.cpp
@@ -98,7 +98,7 @@
bmcSessionID = (crypto::prng::rand());
bmcSessionID &= session::multiIntfaceSessionIDMask;
// In sessionID , BIT 31 BIT30 are used for netipmid instance
- bmcSessionID |= ipmiNetworkInstance << 30;
+ bmcSessionID |= static_cast<uint32_t>(ipmiNetworkInstance) << 30;
/*
* Every IPMI Session has two ID's attached to it Remote Console
* Session ID and BMC Session ID. The remote console ID is passed
@@ -130,7 +130,7 @@
}
sessionHandle &= session::multiIntfaceSessionHandleMask;
// In sessionID , BIT 31 BIT30 are used for netipmid instance
- sessionHandle |= ipmiNetworkInstance << 6;
+ sessionHandle |= static_cast<uint8_t>(ipmiNetworkInstance) << 6;
std::stringstream sstream;
sstream << std::hex << bmcSessionID;
std::stringstream shstream;