Skip to content

Fix CodeSonar Uninitialized Variable warning#126

Open
thesamprice wants to merge 1 commit intonasa:mainfrom
thesamprice:1497-autofix-uninitialized-variable-no-url
Open

Fix CodeSonar Uninitialized Variable warning#126
thesamprice wants to merge 1 commit intonasa:mainfrom
thesamprice:1497-autofix-uninitialized-variable-no-url

Conversation

@thesamprice
Copy link

Location: fsw/src/fm_cmd_utils.c:544
Function: FM_GetVolumeFreeSpace
Rule: Uninitialized Variable
Level: error
Rank: 62.739559173583984/100

Description:
FileStats was not initialized. - FileStats was defined at fm_cmd_utils.c:536. The issue can occur if the highlighted code executes.

🤖 Generated with Claude Code

Checklist (Please check before submitting)

Describe the contribution
A clear and concise description of what the contribution is.

  • Include explicitly what issue it addresses [e.g. Fixes #X]

Testing performed
Steps taken to test the contribution:

  1. Build steps '...'
  2. Execution steps '...'

Expected behavior changes
A clear and concise description of how this contribution will change behavior and level of impact.

  • API Change: xxx (if applicable)
  • Behavior Change: xxx (if applicable)
  • Or no impact to behavior

System(s) tested on

  • Hardware: [e.g. PC, SP0, MCP750]
  • OS: [e.g. Ubuntu 18.04, RTEMS 4.11, VxWorks 6.9]
  • Versions: [e.g. cFE 6.6, OSAL 4.2, PSP 1.3 for mcp750, any related apps or tools]

Additional context
Add any other context about the contribution here.

Third party code
If included, identify any third party code and provide text file of license

Contributor Info - All information REQUIRED for consideration of pull request
Full name and company/organization/center of all contributors ("Personal" if individual work)

  • Note CLA's apply to software contributions.

Location: fsw/src/fm_cmd_utils.c:544
Function: FM_GetVolumeFreeSpace
Rule: Uninitialized Variable
Level: error
Rank: 62.739559173583984/100

Description:
FileStats was not initialized. - FileStats was defined at fm_cmd_utils.c:536. The issue can occur if the highlighted code executes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@thesamprice
Copy link
Author

image

@dzbaker dzbaker self-requested a review March 2, 2026 20:48
@dzbaker dzbaker self-assigned this Mar 2, 2026
osal_status_t OS_Status;
CFE_Status_t Result;

memset(&FileStats, 0, sizeof(FileStats));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this only be meset to 0 on failure instead of all the time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants