Skip to content

audio: dcblock: reject mismatched source/sink frame formats in prepare - #11078

Closed
piotrhoppeintel with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-for-review-comment
Closed

audio: dcblock: reject mismatched source/sink frame formats in prepare#11078
piotrhoppeintel with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-code-for-review-comment

Conversation

Copilot AI commented Aug 10, 2026

Copy link
Copy Markdown

dcblock_prepare() selected the processing function solely from cd->source_format without verifying the sink format matches. A mismatched pipeline would silently proceed and corrupt output by interpreting the sink buffer with the wrong sample type/width.

Change

  • src/audio/dcblock/dcblock.c: Add an explicit format equality check in dcblock_prepare() after both formats are fetched; return -EINVAL if they differ.
if (cd->source_format != cd->sink_format) {
    comp_err(dev, "source and sink frame formats do not match");
    return -EINVAL;
}

This follows the same defensive pattern used for channel-count validation in the same function.

@sofci

sofci commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

Add a check in dcblock_prepare() that rejects pipelines where the
sink frame format does not match the source frame format. Without this
check, the processing kernel would interpret the sink buffer using the
source sample type/width and corrupt output.

Signed-off-by: Copilot <copilot@github.com>

Co-authored-by: piotrhoppeintel <93944786+piotrhoppeintel@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the code for review comment audio: dcblock: reject mismatched source/sink frame formats in prepare Aug 10, 2026
Copilot AI requested a review from piotrhoppeintel August 10, 2026 10:40
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.

3 participants