Skip to content

Commit

Permalink
Fix IPMI FRU Write command returning invalid data
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosr8 committed Aug 21, 2023
1 parent 23d2590 commit 740a089
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/fru.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ size_t fru_write( uint8_t id, uint8_t *tx_buff, uint16_t offset, size_t len )
memcpy( &fru[id].buffer[offset], tx_buff, len );
ret_val = len;
} else {
ret_val = fru[id].cfg.write_f( fru[id].cfg.eeprom_id, offset, tx_buff, len, 0 );
ret_val = fru[id].cfg.write_f( fru[id].cfg.eeprom_id, offset, tx_buff, len, 10 );
}
return ret_val;
}
Expand Down Expand Up @@ -341,5 +341,15 @@ IPMI_HANDLER(ipmi_storage_write_fru_data_cmd, NETFN_STORAGE, IPMI_WRITE_FRU_DATA
rsp->data[len++] = 0;
rsp->completion_code = IPMI_CC_PARAM_OUT_OF_RANGE;
}

/*
* If count == 0, it may indicate that the fru_write function
* failed somehow.
*/

if (count == 0) {
rsp->completion_code = IPMI_CC_UNSPECIFIED_ERROR;
return ;
}
rsp->data_len = len;
}

0 comments on commit 740a089

Please sign in to comment.