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 #2282, Move calls to CFE_SB_GetPipeName() up higher to reduce duplication #2283

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
8 changes: 2 additions & 6 deletions modules/sb/fsw/src/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,13 +1676,13 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_
/* send an event for each pipe write error that may have occurred */
for (i = 0; i < SBSndErr.EvtsToSnd; i++)
{
CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId);

Check warning

Code scanning / CodeQL

Uses of recursion

The function CFE_SB_BroadcastBufferToRoute is indirectly recursive via this call to [CFE_SB_GetPipeName](1). The function CFE_SB_BroadcastBufferToRoute is indirectly recursive via this call to [CFE_SB_GetPipeName](2).

if (SBSndErr.EvtBuf[i].EventId == CFE_SB_MSGID_LIM_ERR_EID)
{
/* Determine if event can be sent without causing recursive event problem */
if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_MSGID_LIM_ERR_EID_BIT) == CFE_SB_GRANTED)
{
CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId);

CFE_ES_PerfLogEntry(CFE_MISSION_SB_MSG_LIM_PERF_ID);
CFE_ES_PerfLogExit(CFE_MISSION_SB_MSG_LIM_PERF_ID);

Expand All @@ -1700,8 +1700,6 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_
/* Determine if event can be sent without causing recursive event problem */
if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_Q_FULL_ERR_EID_BIT) == CFE_SB_GRANTED)
{
CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId);

CFE_ES_PerfLogEntry(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID);
CFE_ES_PerfLogExit(CFE_MISSION_SB_PIPE_OFLOW_PERF_ID);

Expand All @@ -1719,8 +1717,6 @@ void CFE_SB_BroadcastBufferToRoute(CFE_SB_BufferD_t *BufDscPtr, CFE_SBR_RouteId_
/* Determine if event can be sent without causing recursive event problem */
if (CFE_SB_RequestToSendEvent(TskId, CFE_SB_Q_WR_ERR_EID_BIT) == CFE_SB_GRANTED)
{
CFE_SB_GetPipeName(PipeName, sizeof(PipeName), SBSndErr.EvtBuf[i].PipeId);

CFE_EVS_SendEventWithAppID(CFE_SB_Q_WR_ERR_EID, CFE_EVS_EventType_ERROR, CFE_SB_Global.AppId,
"Pipe Write Err,MsgId 0x%x,pipe %s,sender %s,stat %ld",
(unsigned int)CFE_SB_MsgIdToValue(BufDscPtr->MsgId), PipeName,
Expand Down
4 changes: 2 additions & 2 deletions modules/sb/ut-coverage/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -4499,7 +4499,7 @@ void Test_SB_TransmitMsgPaths_FullErr(void)

CFE_UtAssert_EVENTNOTSENT(CFE_SB_Q_FULL_ERR_EID_BIT);

CFE_UtAssert_EVENTCOUNT(2);
CFE_UtAssert_EVENTCOUNT(3);

CFE_UtAssert_TEARDOWN(CFE_SB_DeletePipe(PipeId));
}
Expand Down Expand Up @@ -4535,7 +4535,7 @@ void Test_SB_TransmitMsgPaths_WriteErr(void)

CFE_UtAssert_SUCCESS(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmPkt.TelemetryHeader), true));

CFE_UtAssert_EVENTCOUNT(2);
CFE_UtAssert_EVENTCOUNT(3);

CFE_UtAssert_EVENTNOTSENT(CFE_SB_Q_WR_ERR_EID);

Expand Down