Add limit check to fan speed offset
ipmiOEMSetFanSpeedOffset was accepting offset value greater
than its limit. Fix added for limit check for fan speed offset.
Tested :
Verified using IPMI command.
Command: ipmitool raw 0x30 0x8C 0x65 //set fan speed offset to 101.
Response: Unable to send RAW command (channel=0x0 netfn=0x30
lun=0x0 cmd=0x8c rsp=0xcc): Invalid data field in request
Signed-off-by: Manish Baing <manish.baing@intel.com>
Change-Id: I99b6a18dc69b7956c4488f39306fb69afd1f522b
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index e25e40d..89269cd 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1781,6 +1781,13 @@
ipmi::RspType<> ipmiOEMSetFanSpeedOffset(uint8_t offset)
{
+ constexpr uint8_t maxFanSpeedOffset = 100;
+ if (offset > maxFanSpeedOffset)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(
+ "ipmiOEMSetFanSpeedOffset: fan offset greater than limit");
+ return ipmi::responseInvalidFieldRequest();
+ }
boost::container::flat_map<std::string, PropertyMap> data = getPidConfigs();
if (data.empty())
{