Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The corrected zero-source path lacks regression test coverage.
1 open finding
What changed in this PR
Fixes demux processing when no source is connected, preventing a null-source access.
Changes:
- Uses source and sink counts as authoritative guards.
- Consolidates the early-return conditions.
| File | Description |
|---|---|
src/audio/mux/mux.c |
Corrects the demux no-source guard. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
|
|
||
| if (sources == NULL && sources[0] == NULL) { | ||
| /* if there are no sources or sinks active, then there is nothing to do */ | ||
| if (num_of_sources == 0 || num_of_sinks == 0) { |
Member
There was a problem hiding this comment.
cmocka being deprecated in favour of ztests so acceptable.
The guard read "sources == NULL && sources[0] == NULL". mod->sources is a fixed array inside struct processing_module, so the array argument decays to a non-NULL address and the first operand is always false. The condition is therefore tautologically false and the intended check never runs. struct processing_module is memset to zero on allocation, so with no source bound sources[0] is NULL and the function falls through to source_get_data_frames_available(NULL). Check num_of_sources instead of probing sources[0]. The count is the authoritative indication of whether a source is connected, whereas a NULL sources[0] only reflects the zeroed allocation. This also matches mux_process() in the same file and the guards used by copier, volume, rtnr and dts. The separate num_of_sinks test is folded into the same condition. Note: clang-analyzer-core.NullDereference reported this as a deref of a NULL sources array; that path is unreachable because sources can never be NULL. The defect is the dead check, not the reported deref. Assisted-by: Copilot:claude-opus-5 clang-tidy Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
PR 11284: test resultsRun date: 2026-10-08 13:31 UTC Tested commit: b54c14934fe1e4528f44d44d29e1e76cd2293102 |
tmleman
requested review from
abonislawski,
kv2019i,
lgirdwood,
piotrhoppeintel,
serhiy-katsyuba-intel,
softwarecki and
wjablon1
October 8, 2026 12:43
lgirdwood
approved these changes
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The guard read "sources == NULL && sources[0] == NULL". mod->sources is a fixed array inside struct processing_module, so the array argument decays to a non-NULL address and the first operand is always false. The condition is therefore tautologically false and the intended check never runs.
struct processing_module is memset to zero on allocation, so with no source bound sources[0] is NULL and the function falls through to source_get_data_frames_available(NULL).
Check num_of_sources instead of probing sources[0]. The count is the authoritative indication of whether a source is connected, whereas a NULL sources[0] only reflects the zeroed allocation. This also matches mux_process() in the same file and the guards used by copier, volume, rtnr and dts. The separate num_of_sinks test is folded into the same condition.
Note: clang-analyzer-core.NullDereference reported this as a deref of a NULL sources array; that path is unreachable because sources can never be NULL. The defect is the dead check, not the reported deref.
Assisted-by: Copilot:claude-opus-5 clang-tidy