Skip to content

Fixed uninitialized mapped sector state in NOR erase search - #83

Merged
fdesbiens merged 2 commits into
eclipse-threadx:masterfrom
miracoli:agent/fix-uninitialized-mapped-sector-count
Sep 25, 2026
Merged

fdesbiens merged 2 commits into
eclipse-threadx:masterfrom
miracoli:agent/fix-uninitialized-mapped-sector-count

Conversation

@miracoli

@miracoli miracoli commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

The NOR erase search can obtain an obsolete count from the cache or block metadata without scanning the mapping table. It then copied an uninitialized mapped count into candidate state, which GCC could report as a maybe-uninitialized value.

The search now initializes the availability flag and resets the mapped count for each block. It still scans the chosen block before returning a mapped count when one was unavailable. A simulator regression checks a cached block with one obsolete and fourteen mapped sectors.

GCC 15 with -O2 -Werror=maybe-uninitialized rejected the base revision and built this PR. CMake/Ninja regression tests passed 3/3 in each of the obsolete count cache, combined cache, and default coverage configurations. Not run on hardware.

@fdesbiens

Copy link
Copy Markdown
Contributor

Hi @miracoli.

Thank you for this contribution. @rahmanih, Would you be so kind as to review it, please?

@fdesbiens
fdesbiens requested a review from rahmanih July 28, 2026 14:54
@fdesbiens fdesbiens moved this to In review in ThreadX Roadmap Jul 28, 2026

@rahmanih rahmanih left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Image

The cached obsolete-count path lacked a direct assertion for the mapped-sector
count returned to block reclamation.

Added a simulator case with one obsolete and fourteen mapped sectors. It checks
cache coverage, the selected block, and the returned erase and sector counts.

CMake/Ninja regression tests passed 3/3 in each of the obsolete count cache,
combined cache, and default coverage builds. Not run on hardware.

Assisted-by: Codex (GPT-6) <noreply@openai.com>
@fdesbiens fdesbiens changed the title Fix uninitialized mapped sector state in NOR erase block search Fixed uninitialized mapped sector state in NOR erase search Sep 25, 2026
@fdesbiens
fdesbiens merged commit a9fbfad into eclipse-threadx:master Sep 25, 2026
1 check passed
@fdesbiens

Copy link
Copy Markdown
Contributor

Thank you, @miracoli, for the fix, and @rahmanih for the review. This will be part of the v6.5.2 release next week.

fdesbiens added a commit that referenced this pull request Sep 25, 2026
The NOR erase search fix from #83 landed on master while dev still used an uninitialized mapped count when obsolete counts came from cache or block metadata.

Merge the master fix and its simulator regression into dev while preserving dev's newer cache tests.

Repository checks, ECA, and the full regression job passed on the updated branch. Local GCC 14 CMake/Ninja tests passed 40/40 across ten configurations. Not run on hardware.

Assisted-by: Codex (GPT-6) <noreply@openai.com>
fdesbiens pushed a commit that referenced this pull request Sep 25, 2026
On allocation failure, NOR block reclaim compared a null sector address with
block pointers before reporting the error; in direct read builds, the old
return could also use an uninitialized status.

Return LX_SYSTEM_ALLOCATION_FAILED and skip address comparisons when allocation
leaves its output null. A regression checks failures on the initial allocation
and retry in buffered and direct read builds. Thanks to @jiri-novotny for
identifying the status defect in #21.

GCC 14 CMake/Ninja tests passed 50/50 across ten configurations with #83 on
dev. Merged coverage reached 1,646/2,404 lines (68.47%) and 1,614/2,451
branches (65.85%). GitHub repository checks, ECA, and the full regression job
passed. Not run on hardware.

Assisted-by: Codex (GPT-6) <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants