nasa / CF

The Core Flight System (cFS) CFDP application.
Apache License 2.0
86 stars 46 forks source link

Unreachable code block in check for CF_SEND_NO_MSG #39

Closed jphickey closed 2 years ago

jphickey commented 2 years ago

This issue was imported from the GSFC issue tracking system

Imported from: [GSFCCFS-1775] Unreachable code block in check for CF_SEND_NO_MSG Originally submitted by: Hickey, Joseph P. (GSFC-582.0)[VANTAGE SYSTEMS INC] on Tue Nov 16 14:19:04 2021

Original Description: This issue was originally reported by IV&V, creating Jira issue to track its disposition and resolution.

The code within the IF block in cf_cfdp_s.c in the CF App source code, namely lines 158-159 will never be executed. The IF block checks variable 'status' if it is CF_SEND_NO_MSG on line 157, this variable originates from the return value of CF_CFDP_SendFd(), which can only return values CF_SEND_SUCCESS and CF_SEND_ERROR.

jphickey commented 2 years ago

This is still technically true, because CF_CFDP_S_SendFileData gets a message buffer at the very beginning. The call to CF_CFDP_SendFd in this case is really only sending it, which is different than other Send routines that both acquire a buffer and send it.

Because the buffer was already successfully acquired earlier, checking for CF_SEND_NO_MSG is redundant. Although technically it is a valid return code from this call per the API, it won't ever be returned in reality.

Probably worth a fix to remove unreachable code, but this is fairly minor.

skliper commented 2 years ago

OBE - likely went away in one of the refactor commits. Marking as invalid relative to current implementation.