Skip to content

audio: eq_iir: register IPC-time blob validator#10942

Open
singalsu wants to merge 2 commits into
thesofproject:mainfrom
singalsu:model_handler_validator_eqiir
Open

audio: eq_iir: register IPC-time blob validator#10942
singalsu wants to merge 2 commits into
thesofproject:mainfrom
singalsu:model_handler_validator_eqiir

Conversation

@singalsu

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/audio/eq_iir/eq_iir_generic.c Outdated
}
if (lookup) {
for (; i < SOF_EQ_IIR_MAX_RESPONSES; i++)
lookup[i] = NULL;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

memset()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep, and the memset can be before the loop.

Comment thread src/audio/eq_iir/eq_iir.c Outdated
return -EINVAL;
}

return 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you never propagate this function's returned error code and always use it as a condition in if clauses. How about making it boolean

static bool eq_iir_blob_size_valid(struct comp_dev *dev, size_t size)
{
	return size >= sizeof(struct sof_eq_iir_config) && size <= SOF_EQ_IIR_MAX_SIZE;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, I'll change to this.

Hook an eq_iir blob validator into the model handler so a corrupted
run-time configuration update is rejected before it can replace the
working blob. Playback or capture then continues with the previously
set coefficients instead of being interrupted by a bad IPC.

The validator parses the blob layout end to end: the size envelope,
channel and response counts, each response header and biquad section
bounds, and the assign_response[] entries reachable by the per-channel
loop. The layout walk is factored into a shared helper that
eq_iir_init_coef() also reuses at setup time, so IPC-time and
prepare-time agree on structural validity; the assign_response[] check
is exclusive to the IPC path, where the full table must be validated
without knowing the stream channel count.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the model_handler_validator_eqiir branch from db4e659 to 442b1d4 Compare June 29, 2026 14:23
Use memset() to zero the unused tail of the response lookup array in
eq_iir_walk_config() instead of a per-slot loop. The walk pre-clears
the whole table once when a lookup is requested and then fills the
in-use entries.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu marked this pull request as ready for review June 29, 2026 15:19
Copilot AI review requested due to automatic review settings June 29, 2026 15:19

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.

Pull request overview

This PR adds an IPC-time configuration blob validator for the EQ IIR component so malformed coefficient updates are rejected before they can replace a working runtime configuration. It aligns EQ IIR behavior with existing components (e.g., EQ FIR) that install a blob validator during prepare() and clear it on reset().

Changes:

  • Introduces eq_iir_validate_config() and exposes it via eq_iir.h.
  • Refactors EQ IIR blob parsing to share a common structural validation walk (eq_iir_walk_config()).
  • Registers the validator in eq_iir_prepare() (and unregisters in eq_iir_reset()), removing the redundant run-time blob size check in the audio processing path.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/audio/eq_iir/eq_iir.h Declares the new eq_iir_validate_config() entry point used for IPC-time validation.
src/audio/eq_iir/eq_iir.c Uses the validator in prepare(), registers/unregisters it, and simplifies the run-time update path.
src/audio/eq_iir/eq_iir_generic.c Implements structural blob validation and assign-response validation, reusing shared parsing logic.

@singalsu singalsu requested review from kv2019i, lgirdwood and lyakh June 29, 2026 15:57
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