Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions common/service/pldm/pldm_firmware_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
#define GET_EEPROM_SLAVE_MASK(offset) (((offset) >> 16) & 0xF)
#define GET_EERPOM_OFFSET(offset) ((offset) & 0xFFFF)

#ifndef PLDM_UPDATE_DELAY_AFTER_POST_UPDATE
#define PLDM_UPDATE_DELAY_AFTER_POST_UPDATE 3000
#endif

pldm_fw_update_info_t *comp_config = NULL;
uint8_t comp_config_count = 0;

Expand Down Expand Up @@ -672,7 +676,7 @@
CHECK_NULL_ARG_WITH_RETURN(ext_params, 0);

pldm_msg msg = { 0 };
mctp_ext_params *extra_data = (mctp_ext_params *)ext_params;

Check failure on line 679 in common/service/pldm/pldm_firmware_update.c

View workflow job for this annotation

GitHub Actions / Aggregate-Lint-Output

[] reported by reviewdog 🐶 Variable 'extra_data' can be declared as pointer to const Raw Output: common/service/pldm/pldm_firmware_update.c:679:19:Variable 'extra_data' can be declared as pointer to const

msg.ext_params = *extra_data;

Expand Down Expand Up @@ -958,6 +962,16 @@
apply_result = fw_info->self_apply_work_func(fw_info->self_apply_work_arg);
}

#ifdef PLDM_UPDATE_POST_UPDATE_BEFORE_APPLY_COMPLETE
if (fw_info->pos_update_func) {
if (fw_info->pos_update_func(&update_param)) {
LOG_ERR("post-update failed!");
apply_result = PLDM_FW_UPDATE_GENERIC_ERROR;
}
}
k_msleep(PLDM_UPDATE_DELAY_AFTER_POST_UPDATE);
#endif

if (report_tranfer(mctp_p, ext_params, apply_result)) {
report_tranfer(mctp_p, ext_params, PLDM_FW_UPDATE_GENERIC_ERROR);
cur_aux_state = STATE_AUX_FAILED;
Expand All @@ -968,12 +982,15 @@
cur_aux_state = STATE_AUX_SUCCESS;

exit:
#ifndef PLDM_UPDATE_POST_UPDATE_BEFORE_APPLY_COMPLETE
/* do post-update */
if (fw_info->pos_update_func) {
if (fw_info->pos_update_func(&update_param)) {
LOG_ERR("post-update failed!");
}
}
#endif

fw_update_cfg.image_size = 0;
if (fw_update_tid) {
fw_update_tid = NULL;
Expand Down Expand Up @@ -1240,7 +1257,7 @@
CHECK_NULL_ARG_WITH_RETURN(resp_len, PLDM_ERROR);
CHECK_NULL_ARG_WITH_RETURN(ext_params, PLDM_ERROR);

struct pldm_activate_firmware_req *req_p = (struct pldm_activate_firmware_req *)buf;

Check failure on line 1260 in common/service/pldm/pldm_firmware_update.c

View workflow job for this annotation

GitHub Actions / Aggregate-Lint-Output

[] reported by reviewdog 🐶 Variable 'req_p' can be declared as pointer to const Raw Output: common/service/pldm/pldm_firmware_update.c:1260:37:Variable 'req_p' can be declared as pointer to const
struct pldm_activate_firmware_resp *resp_p = (struct pldm_activate_firmware_resp *)resp;

*resp_len = 1;
Expand Down Expand Up @@ -1717,7 +1734,7 @@
descriptor_count -= type_length;

for (index = 0; index < type_length; ++index) {
strncpy(data, &descriptor->descriptor_data[index * 2], 2);

Check failure on line 1737 in common/service/pldm/pldm_firmware_update.c

View workflow job for this annotation

GitHub Actions / Aggregate-Lint-Output

[] reported by reviewdog 🐶 The buffer 'data' may not be null-terminated after the call to strncpy(). Raw Output: common/service/pldm/pldm_firmware_update.c:1737:4:The buffer 'data' may not be null-terminated after the call to strncpy().
val = strtol(data, NULL, 16);
tlv_ptr->descriptor_data[index] = val;
}
Expand Down
2 changes: 2 additions & 0 deletions meta-facebook/minerva-ag/src/platform/plat_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#define EEPROM_WRITE_SIZE 0x80

#define PLDM_UPDATE_POST_UPDATE_BEFORE_APPLY_COMPLETE

#define MAX_AUX_SENSOR_NAME_LEN 58

#define PLDM_MSG_TIMEOUT_MS 5000
Expand Down
Loading