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
5 changes: 3 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Static Analysis

# Run on all push and pull requests
on:
push:
branches:
Expand All @@ -16,4 +15,6 @@ on:
jobs:
static-analysis:
name: Static Analysis
uses: nasa/cFS/.github/workflows/app-static-analysis-reusable.yml@dev
uses: nasa/cFS/.github/workflows/static-analysis-reusable.yml@dev
with:
source-dir: 'source/fsw'
2 changes: 1 addition & 1 deletion fsw/inc/fm_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
* or equal to zero.
*/
#define FM_MISSION_REV FM_INTERNAL_CFGVAL(MISSION_REV)
#define DEFAULT_FM_INTERNAL_MISSION_REV 0
#define DEFAULT_FM_INTERNAL_MISSION_REV 0xFF

/**
* \brief Child file stat sleep
Expand Down
19 changes: 16 additions & 3 deletions fsw/src/fm_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,14 @@ CFE_Status_t FM_MonitorFilesystemSpaceCmd(const FM_MonitorFilesystemSpaceCmd_t *
/* Acquire pointer to file system free space table, also locks table */
Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);

/* Verify that we have a pointer to the file system table data */
if (Status == CFE_TBL_ERR_NEVER_LOADED)
/*
** Per cfe_tbl.h, CFE_TBL_GetAddress leaves the table pointer undefined on
** any non-success return. Only CFE_SUCCESS and CFE_TBL_INFO_UPDATED set
** the pointer. Prior versions only handled CFE_TBL_ERR_NEVER_LOADED and
** would dereference an undefined pointer on _INVALID_HANDLE / _NO_ACCESS /
** CFE_ES_ERR_RESOURCEID_NOT_VALID / CFE_TBL_BAD_ARGUMENT.
*/
if (Status != CFE_SUCCESS && Status != CFE_TBL_INFO_UPDATED)
{
/* Make sure we don't try to use the empty table buffer */
FM_AppData.MonitorTablePtr = NULL;
Expand Down Expand Up @@ -974,7 +980,14 @@ CFE_Status_t FM_SetTableStateCmd(const FM_SetTableStateCmd_t *Msg)

/* Acquire pointer to file system free space table */
Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);
if (Status == CFE_TBL_ERR_NEVER_LOADED)
/*
** Per cfe_tbl.h, CFE_TBL_GetAddress leaves the table pointer undefined on
** any non-success return. Only CFE_SUCCESS and CFE_TBL_INFO_UPDATED set
** the pointer. Prior versions only handled CFE_TBL_ERR_NEVER_LOADED and
** would dereference an undefined pointer on _INVALID_HANDLE / _NO_ACCESS /
** CFE_ES_ERR_RESOURCEID_NOT_VALID / CFE_TBL_BAD_ARGUMENT.
*/
if (Status != CFE_SUCCESS && Status != CFE_TBL_INFO_UPDATED)
{
/* Make sure we don't try to use the empty table buffer */
FM_AppData.MonitorTablePtr = NULL;
Expand Down
15 changes: 12 additions & 3 deletions fsw/src/fm_table_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ CFE_Status_t FM_TableInit(void)
if (Status == CFE_SUCCESS)
{
/* Make an attempt to load the default table data - OK if this fails */
CFE_TBL_Load(FM_AppData.MonitorTableHandle, CFE_TBL_SRC_FILE, FM_TABLE_DEF_NAME);
/* SAD: Suppress Ignored Return Value warning from CodeSonar. CFE_TBL_Load() will send event message if
* there is any error */
(void)CFE_TBL_Load(FM_AppData.MonitorTableHandle, CFE_TBL_SRC_FILE, FM_TABLE_DEF_NAME);

/* Allow cFE a chance to dump, update, etc. */
FM_AcquireTablePointers();
Expand Down Expand Up @@ -211,9 +213,16 @@ void FM_AcquireTablePointers(void)
/* Acquire pointer to file system free space table */
Status = CFE_TBL_GetAddress((void *)&FM_AppData.MonitorTablePtr, FM_AppData.MonitorTableHandle);

if (Status == CFE_TBL_ERR_NEVER_LOADED)
/*
** Per cfe_tbl.h, CFE_TBL_GetAddress leaves the table pointer undefined on
** any non-success return (CFE_TBL_ERR_NEVER_LOADED, _INVALID_HANDLE,
** _NO_ACCESS, CFE_ES_ERR_RESOURCEID_NOT_VALID, CFE_TBL_BAD_ARGUMENT).
** Only CFE_SUCCESS and CFE_TBL_INFO_UPDATED set the pointer. NULL out
** the local copy on any other return so callers see a clean NULL rather
** than a stale or undefined pointer.
*/
if (Status != CFE_SUCCESS && Status != CFE_TBL_INFO_UPDATED)
{
/* Make sure we don't try to use the empty table buffer */
FM_AppData.MonitorTablePtr = NULL;
}
}
Expand Down
Loading