storagecommands: Fix for GetFruAreaInfo command
Issue: GetFruAreaInfo command is giving incorrect response for Invalid
FRU Device ID's.
Fix: Add check for invalid FRU Device ID's to return completion code as
0xCB.
Tested:
Verified using ipmitool raw commands.
Case 1: Valid FRU Device ID:
Command: ipmitool raw 0x0a 0x10 0xce //Get fru Area info
Response: a9 00 00
Case 2: Invalid FRU Device ID:
Command: ipmitool raw 0x0a 0x10 0x01 //Get fru Area info
Response: Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0
cmd=0x10 rsp=0xcb): Requested sensor, data, or record not
found
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I8e3416beff40c133804af9e913d83c2372784439
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index f1b98e0..bd43a34 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -538,7 +538,11 @@
return ipmi::responseInvalidFieldRequest();
}
- getFru(ctx, fruDeviceId);
+ ipmi::Cc ret = getFru(ctx, fruDeviceId);
+ if (ret != ipmi::ccSuccess)
+ {
+ return ipmi::response(ret);
+ }
constexpr uint8_t accessType =
static_cast<uint8_t>(GetFRUAreaAccessType::byte);