From b6d0afb0f62b1930a223e44192352b0abf912dd3 Mon Sep 17 00:00:00 2001 From: Alexander Rube Date: Mon, 26 Oct 2015 09:12:38 +0100 Subject: [PATCH] ID:395 - Fix fru string without resizing it Editing a fru without resizing it caused the checksum being incorrect and not being updated. This fix changes this, so the checksum is now being correctly calculated and written to the right place. --- lib/ipmi_fru.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c index 175f044..40f98e7 100644 --- a/lib/ipmi_fru.c +++ b/lib/ipmi_fru.c @@ -4772,13 +4772,12 @@ f_type, uint8_t f_index, char *f_string) checksum = 0; /* Calculate Header Checksum */ - for( i = header_offset; i < header_offset - + fru_section_len - 1; i ++ ) + for (i = 0; i < fru_section_len - 1; i++) { checksum += fru_data[i]; } checksum = (~checksum) + 1; - fru_data[header_offset + fru_section_len - 1] = checksum; + fru_data[fru_section_len - 1] = checksum; /* Write the updated section to the FRU data; source offset => 0 */ if( write_fru_area(intf, &fru, fruId, 0,