[PATCH ipmi-fru-parser] Handle IOBoard VPD for Barreleye

OpenBMC Patches openbmc-patches at stwcx.xyz
Wed Jun 29 08:40:15 AEST 2016


From: Adriana Kobylak <anoo at us.ibm.com>

Due to changes to the IOBoard VPD for Barreleye to include the MAC
address, the fru parser needs hardening to handle these changes.
First do not try to read data if the area length is 0. Second
adjust the area length as the checksum is now at a 4 byte
boundary instead of 8. The IOBOARD_WORKAROUND macro will be
added in the barreleye recipe.
Fixes openbmc/ipmi-fru-parser#19

Signed-off-by: Adriana Kobylak <anoo at us.ibm.com>
---
 writefrudata.C | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/writefrudata.C b/writefrudata.C
index 6791148..9cb4d9d 100644
--- a/writefrudata.C
+++ b/writefrudata.C
@@ -469,6 +469,26 @@ int ipmi_populate_fru_areas(uint8_t *fru_data, const size_t data_len,
 
             // Size of this area will be the 2nd byte in the fru area header.
             size_t  area_len = area_hdr[1] * IPMI_EIGHT_BYTES;
+
+            // If area size is 0, skip it
+            if (!area_len)
+            {
+                continue;
+            }
+
+#ifdef IOBOARD_WORKAROUND
+            if (fru_entry == IPMI_FRU_BOARD_OFFSET)
+            {
+                // Adjust board area length since it ends in a 4 byte
+                // boundary instead of 8
+                area_len -= 3;
+            }
+            else if (fru_entry == IPMI_FRU_PRODUCT_OFFSET)
+            {
+                // Skip the product area, there's no data there
+                break;
+            }
+#endif
             uint8_t area_data[area_len] = {0};
 
             printf("fru data size:[%d], area offset:[%d], area_size:[%d]\n",
-- 
2.9.0




More information about the openbmc mailing list