Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPMI FRU Write command returning invalid data #170

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}