Skip to content
Merged
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
11 changes: 11 additions & 0 deletions src/audio/rtnr/rtnr.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ static int rtnr_get_config(struct processing_module *mod,
return rtnr_get_bin_data(mod, cdata, fragment_size);

case SOF_CTRL_CMD_SWITCH:
if (cdata->num_elems > SOF_IPC_MAX_CHANNELS) {
comp_err(dev, "num_elems %u > max %u",
cdata->num_elems, SOF_IPC_MAX_CHANNELS);
return -EINVAL;
}
Comment on lines +457 to +461

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reworded — the behaviour is intentional rejection (a control message with more elements than channels is malformed). I consolidated the get/set changes into a single commit titled "rtnr: reject out-of-range control switch element counts" and updated the PR description to match.

for (j = 0; j < cdata->num_elems; j++) {
cdata->chanv[j].channel = j;
cdata->chanv[j].value = cd->process_enable;
Expand Down Expand Up @@ -560,6 +565,12 @@ static int32_t rtnr_set_value(struct processing_module *mod, void *ctl_data)
uint32_t val = 0;
int32_t j;

if (cdata->num_elems > SOF_IPC_MAX_CHANNELS) {
comp_err(dev, "num_elems %u > max %u",
cdata->num_elems, SOF_IPC_MAX_CHANNELS);
return -EINVAL;
}
Comment on lines +568 to +572

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed — both messages now include the limit: num_elems %u > max %u (with SOF_IPC_MAX_CHANNELS).


for (j = 0; j < cdata->num_elems; j++) {
val |= cdata->chanv[j].value;
comp_dbg(dev, "value = %u", val);
Expand Down
Loading