mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
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.
This commit is contained in:
parent
5be090f047
commit
b6d0afb0f6
@ -4772,13 +4772,12 @@ f_type, uint8_t f_index, char *f_string)
|
|||||||
|
|
||||||
checksum = 0;
|
checksum = 0;
|
||||||
/* Calculate Header Checksum */
|
/* Calculate Header Checksum */
|
||||||
for( i = header_offset; i < header_offset
|
for (i = 0; i < fru_section_len - 1; i++)
|
||||||
+ fru_section_len - 1; i ++ )
|
|
||||||
{
|
{
|
||||||
checksum += fru_data[i];
|
checksum += fru_data[i];
|
||||||
}
|
}
|
||||||
checksum = (~checksum) + 1;
|
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 */
|
/* Write the updated section to the FRU data; source offset => 0 */
|
||||||
if( write_fru_area(intf, &fru, fruId, 0,
|
if( write_fru_area(intf, &fru, fruId, 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user