-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Checklist
- I reviewed the Contributing Guide.
- I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
Name variable used in final error event before being filled in 2 functions.
Code snips
CS_RecomputeBaselineAppCmd
Lines 126 to 181 in f958cc0
| void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr) | |
| { | |
| /* command verification variables */ | |
| CFE_ES_TaskId_t ChildTaskID; | |
| CFE_Status_t Status; | |
| CS_Res_App_Table_Entry_t *ResultsEntry; | |
| char Name[OS_MAX_API_NAME]; | |
| if (CS_AppData.HkPacket.Payload.RecomputeInProgress == false && CS_AppData.HkPacket.Payload.OneShotInProgress == false) | |
| { | |
| strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); | |
| Name[sizeof(Name) - 1] = '\0'; | |
| /* make sure the entry is a valid number and is defined in the table */ | |
| if (CS_GetAppResTblEntryByName(&ResultsEntry, Name)) | |
| { | |
| /* There is no child task running right now, we can use it*/ | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = true; | |
| /* fill in child task variables */ | |
| CS_AppData.ChildTaskTable = CS_APP_TABLE; | |
| CS_AppData.RecomputeAppEntryPtr = ResultsEntry; | |
| Status = CFE_ES_CreateChildTask(&ChildTaskID, CS_RECOMP_APP_TASK_NAME, CS_RecomputeAppChildTask, NULL, | |
| CFE_PLATFORM_ES_DEFAULT_STACK_SIZE, CS_CHILD_TASK_PRIORITY, 0); | |
| if (Status == CFE_SUCCESS) | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_APP_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG, | |
| "Recompute baseline of app %s started", Name); | |
| CS_AppData.HkPacket.Payload.CmdCounter++; | |
| } | |
| else /* child task creation failed */ | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Recompute baseline of app %s failed, CFE_ES_CreateChildTask returned: 0x%08X", | |
| Name, (unsigned int)Status); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = false; | |
| } | |
| } | |
| else | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_UNKNOWN_NAME_APP_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "App recompute baseline failed, app %s not found", Name); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } | |
| else | |
| { | |
| /*send event that we can't start another task right now */ | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "App recompute baseline for app %s failed: child task in use", Name); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } |
CS_RecomputeBaselineTablesCmd
Lines 127 to 181 in f958cc0
| void CS_RecomputeBaselineTablesCmd(const CS_TableNameCmd_t *CmdPtr) | |
| { | |
| CFE_ES_TaskId_t ChildTaskID; | |
| CFE_Status_t Status; | |
| CS_Res_Tables_Table_Entry_t *ResultsEntry; | |
| char Name[CFE_TBL_MAX_FULL_NAME_LEN]; | |
| if (CS_AppData.HkPacket.Payload.RecomputeInProgress == false && CS_AppData.HkPacket.Payload.OneShotInProgress == false) | |
| { | |
| strncpy(Name, CmdPtr->Payload.Name, sizeof(Name) - 1); | |
| Name[sizeof(Name) - 1] = '\0'; | |
| /* make sure the entry is a valid number and is defined in the table */ | |
| if (CS_GetTableResTblEntryByName(&ResultsEntry, Name)) | |
| { | |
| /* There is no child task running right now, we can use it*/ | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = true; | |
| /* fill in child task variables */ | |
| CS_AppData.ChildTaskTable = CS_TABLES_TABLE; | |
| CS_AppData.RecomputeTablesEntryPtr = ResultsEntry; | |
| Status = CFE_ES_CreateChildTask(&ChildTaskID, CS_RECOMP_TABLES_TASK_NAME, CS_RecomputeTablesChildTask, | |
| NULL, CFE_PLATFORM_ES_DEFAULT_STACK_SIZE, CS_CHILD_TASK_PRIORITY, 0); | |
| if (Status == CFE_SUCCESS) | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG, | |
| "Recompute baseline of table %s started", Name); | |
| CS_AppData.HkPacket.Payload.CmdCounter++; | |
| } | |
| else /* child task creation failed */ | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Recompute baseline of table %s failed, CFE_ES_CreateChildTask returned: 0x%08X", | |
| Name, (unsigned int)Status); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| CS_AppData.HkPacket.Payload.RecomputeInProgress = false; | |
| } | |
| } | |
| else | |
| { | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_UNKNOWN_NAME_TABLES_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Tables recompute baseline failed, table %s not found", Name); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } | |
| else | |
| { | |
| /*send event that we can't start another task right now */ | |
| CFE_EVS_SendEvent(CS_RECOMPUTE_TABLES_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR, | |
| "Tables recompute baseline for table %s failed: child task in use", Name); | |
| CS_AppData.HkPacket.Payload.CmdErrCounter++; | |
| } | |
| } |
Expected behavior
Fill in before the first if block.
Reporter Info
Avi Weiss @thnkslprpt
Metadata
Metadata
Assignees
Labels
No labels