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 #84, Remove side-effects and superfluous initializations #85

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
1 change: 0 additions & 1 deletion .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
pull_request:


jobs:
codeql:
name: Codeql Analysis
Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/cs_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT
* \param [in] SizeofDefinitionTableEntry The sizeof an entry in the
* definition table
*
* \param [in] SizeofResultsTableEntry The size of an enrty in the
* \param [in] SizeofResultsTableEntry The size of an entry in the
* results table
*
* \param [in] CallBackFunction A pointer to a function used to
Expand Down Expand Up @@ -367,7 +367,7 @@ CFE_Status_t CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handl
void *DefinitionTblPtr, void *ResultsTblPtr, const uint16 Table,
const char *DefinitionTableName, const char *ResultsTableName, const uint16 NumEntries,
const char *DefinitionTableFileName, const void *DefaultDefTableAddress,
const uint16 SizeofDefinitionTableEntry, const uint16 SizeofResultsTableEntry,
const size_t SizeofDefinitionTableEntry, const size_t SizeofResultsTableEntry,
const CFE_TBL_CallbackFuncPtr_t CallBackFunction);

/**
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ CS_AppData_t CS_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_AppMain(void)
{
CFE_Status_t Result = 0;
CFE_Status_t Result;
CFE_SB_Buffer_t *BufPtr = NULL;

/* Performance Log (start time counter) */
Expand Down Expand Up @@ -147,7 +147,7 @@ void CS_AppMain(void)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t CS_AppInit(void)
{
CFE_Status_t Result = CFE_SUCCESS;
CFE_Status_t Result;

/* Register for event services */
Result = CFE_EVS_Register(NULL, 0, 0);
Expand Down Expand Up @@ -264,8 +264,8 @@ CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr)

void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
uint16 CommandCode = 0;
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

CFE_MSG_GetMsgId(&BufPtr->Msg, &MessageID);

Expand Down
262 changes: 139 additions & 123 deletions fsw/src/cs_app_cmds.c

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions fsw/src/cs_compute.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;
CFE_Status_t ResultShare = 0;
CFE_Status_t ResultGetInfo = 0;
CFE_Status_t ResultGetAddress = 0;
CFE_Status_t ResultShare;
CFE_Status_t ResultGetInfo = 0;
CFE_Status_t ResultGetAddress = 0;

/* variables to get the table address */
CFE_TBL_Handle_t LocalTblHandle = CFE_TBL_BAD_TABLE_HANDLE;
Expand Down Expand Up @@ -290,7 +290,7 @@
{
CFE_EVS_SendEvent(CS_COMPUTE_TABLES_ERR_EID, CFE_EVS_EventType_ERROR,
"CS Tables: Problem Getting table %s info Share: 0x%08X, GetInfo: 0x%08X, GetAddress: 0x%08X",
ResultsEntry->Name, (unsigned int)ResultShare, (unsigned int)ResultGetInfo,

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable High

The variable
ResultShare
may not be initialized at this access.
(unsigned int)ResultGetAddress);

Status = CS_ERR_NOT_FOUND;
Expand All @@ -313,7 +313,7 @@
uint32 NewChecksumValue = 0;
CFE_Status_t Status = CFE_SUCCESS;
CFE_Status_t Result;
CFE_Status_t ResultGetResourceID = CS_ERROR;
CFE_Status_t ResultGetResourceID;
CFE_Status_t ResultGetResourceInfo = CS_ERROR;
int32 ResultAddressValid = false;

Expand Down Expand Up @@ -781,11 +781,11 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_OneShotChildTask(void)
{
uint32 NewChecksumValue = 0;
uint32 NumBytesRemainingCycles = 0;
uint32 NumBytesThisCycle = 0;
cpuaddr FirstAddrThisCycle = 0;
uint32 MaxBytesPerCycle = 0;
uint32 NewChecksumValue;
uint32 NumBytesRemainingCycles;
uint32 NumBytesThisCycle;
cpuaddr FirstAddrThisCycle;
uint32 MaxBytesPerCycle;

NewChecksumValue = 0;
NumBytesRemainingCycles = CS_AppData.HkPacket.Payload.LastOneShotSize;
Expand Down
1 change: 0 additions & 1 deletion fsw/src/cs_compute.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* function is used to compute checksums for EEPROM, Memory, the
* OS code segment and the cFE core code segment
*
*
* \par Assumptions, External Events, and Notes:
* None
*
Expand Down
Loading
Loading