Skip to content

probe: check dma_get_status() before using the status - #11285

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/probe/fix/check_error_before_use
Oct 9, 2026
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
tmleman:topic/upstream/pr/probe/fix/check_error_before_use

Conversation

@tmleman

@tmleman tmleman commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

On the Zephyr native driver path the dma_status structure was read into dma->dmapb.avail and free_bytes before the return code was tested, so a failing dma_get_status() propagated uninitialized stack data into the probe buffer accounting.

Move the error check directly after each call and only consume the status on success. Also correct the error trace format specifier from %u to %d.

Found by clang-analyzer-core.uninitialized.Assign.

Assisted-by: Copilot:claude-opus-5 clang-tidy

Copilot AI balanced review requested due to automatic review settings October 8, 2026 09:54

Copilot AI 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.

🟢 Approval recommended

The focused change correctly prevents uninitialized status data from being consumed and preserves legacy-path behavior.

0 open findings

What changed in this PR

Prevents failed DMA status queries from corrupting probe buffer accounting.

Changes:

  • Checks dma_get_status() before consuming status fields.
  • Uses signed formatting for negative error codes.
File Description
src/​probe/​probe.c Safely handles DMA status failures in probe injection.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

On the Zephyr native driver path the dma_status structure was read into
dma->dmapb.avail and free_bytes before the return code was tested, so a
failing dma_get_status() propagated uninitialized stack data into the probe
buffer accounting.

Move the error check directly after each call and only consume the status on
success. Also correct the error trace format specifier from %u to %d.

Found by clang-analyzer-core.uninitialized.Assign.

Assisted-by: Copilot:claude-opus-5 clang-tidy
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
@intel-sofci

intel-sofci commented Oct 8, 2026 •

Copy link
Copy Markdown

PR 11285: test results

Run date: 2026-10-08 18:10 UTC

Tested commit: addab6589fe8d0b44ba1d7a88134c740d971eb47

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lgirdwood
lgirdwood merged commit d41bfb2 into thesofproject:main Oct 9, 2026
47 of 48 checks passed
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.

4 participants