Fix the bugs found in static analysis
This commit fixes the following static analyzer reported issues:
Operands don't affect result
some conditions are not required to check as its always true
Unsigned compared against 0
Unchecked return value from library
Uninitialized scalar variable
Change-Id: I0b1fd426794bb88f6eafcc817cef5dd2f655e1ba
Signed-off-by: PavanKumarIntel <pavanx.kumar.martha@intel.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index 7b7bc81..62b17a0 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -94,9 +94,7 @@
static constexpr const char* cmdMaskStr = "commandMask";
static constexpr int base_16 = 16;
#endif // ENABLE_I2C_WHITELIST_CHECK
-static constexpr uint8_t maxIPMIWriteReadSize = 255;
static constexpr uint8_t oemCmdStart = 192;
-static constexpr uint8_t oemCmdEnd = 255;
static constexpr uint8_t invalidParamSelectorStart = 8;
static constexpr uint8_t invalidParamSelectorEnd = 191;
@@ -1360,7 +1358,7 @@
{
return ipmi::responseInvalidFieldRequest();
}
- if ((paramSelector >= oemCmdStart) && (paramSelector <= oemCmdEnd))
+ if (paramSelector >= oemCmdStart)
{
return ipmi::responseParmNotSupported();
}
@@ -1437,7 +1435,7 @@
{
return ipmi::responseInvalidFieldRequest();
}
- if ((paramSelector >= oemCmdStart) && (paramSelector <= oemCmdEnd))
+ if (paramSelector >= oemCmdStart)
{
return ipmi::responseParmNotSupported();
}
@@ -1702,11 +1700,6 @@
{
return ipmi::responseInvalidFieldRequest();
}
- if (readCount > maxIPMIWriteReadSize)
- {
- log<level::ERR>("Master write read command: Read count exceeds limit");
- return ipmi::responseParmOutOfRange();
- }
const size_t writeCount = writeData.size();
if (!readCount && !writeCount)
{