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

Incomplete OSAL error conversion in CFE_ES_GetTaskName #1672

Closed
jphickey opened this issue Jul 16, 2021 · 0 comments · Fixed by #1873 or #2001
Closed

Incomplete OSAL error conversion in CFE_ES_GetTaskName #1672

jphickey opened this issue Jul 16, 2021 · 0 comments · Fixed by #1873 or #2001
Assignees
Milestone

Comments

@jphickey
Copy link
Contributor

Describe the bug
The CFE_ES_GetTaskName function uses an OSAL API to perform its work. However, its error handling path is not complete, it assumes any underlying OSAL failure is due to the resource ID not being valid:

Result = OS_GetResourceName(OsalId, TaskName, BufferLength);
if (Result != OS_SUCCESS)
{
return CFE_ES_ERR_RESOURCEID_NOT_VALID;
}

Although a bad ID is a likely cause for failure, it is not the only possible cause of failure - for example, if the name is too large to fit in the buffer, OSAL may return OS_ERR_NAME_TOO_LONG.

To Reproduce
Call CFE_ES_GetTaskName with a valid task ID and string buffer size of 1 (such that the task name is too long to fit in the buffer). The function will return CFE_ES_ERR_RESOURCEID_NOT_VALID status, even though the real error was that the buffer was too short.

Expected behavior
Should do better error conversion - only OS_ERR_INVALID_ID should translate to CFE_ES_ERR_RESOURCEID_NOT_VALID, and other potential/foreseeable OSAL errors converted to the nearest CFE ES error, or the generic catch-all CFE_STATUS_EXTERNAL_RESOURCE_FAIL can be returned for other unexpected/unhandled errors.

Additional context
See #1599, for Caelum will document the existing behavior, but a future release should correct this.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey added the bug label Jul 16, 2021
jphickey added a commit to jphickey/cFE that referenced this issue Aug 17, 2021
Provide better status code conversion from OS_GetResourceName
jphickey added a commit to jphickey/cFE that referenced this issue Aug 23, 2021
Provide better status code conversion from OS_GetResourceName
@astrogeco astrogeco added this to the cFS-Draco milestone Sep 7, 2021
@astrogeco astrogeco self-assigned this Oct 28, 2021
astrogeco added a commit to astrogeco/cFE that referenced this issue Nov 3, 2021
Fix nasa#1672, return type conversions in CFE_ES_GetTaskName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants