Skip to content

off-by-one error in CI_LAB_ReadUpLink() #181

@thnkslprpt

Description

@thnkslprpt

Checklist

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
Based on the comment:

/**
* @brief Number of packets to process per ingest cycle
*/
#define CI_LAB_MAX_INGEST_PKTS 10

... CI_LAB_ReadUpLink() will execute one time more than expected (due to the <= in the for condition):

ci_lab/fsw/src/ci_lab_app.c

Lines 213 to 221 in 8c43b9e

void CI_LAB_ReadUpLink(void)
{
int i;
int32 OsStatus;
CFE_Status_t CfeStatus;
CFE_SB_Buffer_t *SBBufPtr;
for (i = 0; i <= CI_LAB_MAX_INGEST_PKTS; i++)

Expected behavior
Execute exactly as many times as expected - if starting at 0, will need to change this to =, rather <=.

Reporter Info
Avi Weiss   @thnkslprpt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions