Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio: Module adapter: Fix in IPC4 invalid blob pass to init() #9501

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/audio/module_adapter/module_adapter_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int module_adapter_init_data(struct comp_dev *dev,
return -EINVAL;

dst->base_cfg = cfg->base_cfg;
dst->size = cfgsz;
dst->size = cfgsz - sizeof(cfg->base_cfg);
Copy link
Member

@lgirdwood lgirdwood Sep 24, 2024

Choose a reason for hiding this comment

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

@singalsu it's probably worth while having a generic accessor macro in the module API header so that IPC4 module data can be easily extracted

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I'm missing still cases when there's the extended config with pins appended (set in rimage for some components). I'm especially not happy with SRC component code change below. The cfg_size_expect gets value 4, from subtract 44 - 40. Also I'm at the moment testing a way to pass in testbench ipc4 build the UUID to avoid the uuid -> rimage id -> uuid translations with normal firmware. So there could be even more varying init ipc sizes.

Do you have ideas how to do this in a nicer way?


if (cfgsz >= sizeof(*cfg)) {
int n_in = cfg->base_cfg_ext.nb_input_pins;
Expand Down
4 changes: 3 additions & 1 deletion src/audio/src/src_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ int src_init(struct processing_module *mod)
struct module_config *cfg = &md->cfg;
struct comp_dev *dev = mod->dev;
struct comp_data *cd = NULL;
const size_t cfg_size_expect = sizeof(cd->ipc_config) -
sizeof(struct ipc4_base_module_cfg);

comp_dbg(dev, "src_init()");

if (!cfg->init_data || cfg->size != sizeof(cd->ipc_config)) {
if (!cfg->init_data || cfg->size != cfg_size_expect) {
comp_err(dev, "src_init(): Missing or bad size (%u) init data",
cfg->size);
return -EINVAL;
Expand Down