Skip to content

Commit 432567f

Browse files
author
Jyri Sarha
committed
volume: Bail out if there is no configuration or it is of wrong size
It is possible to fabricate a message for FW that initializes volume module without a configuration. Make a safe guard again crashing from that. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent b267012 commit 432567f

File tree

1 file changed

+6
-0
lines changed
  • src/audio/module_adapter/module/volume

1 file changed

+6
-0
lines changed

src/audio/module_adapter/module/volume/volume.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,12 @@ static int volume_init(struct processing_module *mod)
407407
const size_t vol_size = sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4;
408408
int i;
409409

410+
if (!vol || cfg->size != sizeof(*vol)) {
411+
comp_err(dev, "volume_init(): No configuration data or bad data size %u",
412+
cfg->size);
413+
return -EINVAL;
414+
}
415+
410416
cd = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, sizeof(struct vol_data));
411417
if (!cd)
412418
return -ENOMEM;

0 commit comments

Comments
 (0)