Fix for get fan control configuration command CC
Issue: Get Fan Control Configuration (8Ah) command returns response
for DIMM Group ID (CPU Number) when CPU is not present.
It should return error response code.
Fix: Added checks for CPUPresent w.r.t. dimmGroupId.
Tested:
ipmitool raw 0x30 0x8a 0 //Success - CPU_1 present
ipmitool raw 0x30 0x8a 1 //0xCC - CPU_2 is not present
Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x8a
rsp=0xcc): Invalid data field in request
Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com>
Change-Id: Ic68bbd6d175b0e803e10af3d759590c0b44ac72f
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index ad2e21e..a5dea03 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1532,6 +1532,18 @@
>
ipmiOEMGetFanConfig(uint8_t dimmGroupId)
{
+ if (dimmGroupId >= maxCPUNum)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
+ bool cpuStatus = cpuPresent("CPU_" + std::to_string(dimmGroupId + 1));
+
+ if (!cpuStatus)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+
boost::container::flat_map<
std::string, std::variant<std::vector<std::string>, std::string>>
profileData;