Skip to content

Commit ccc2b74

Browse files
singalsulgirdwood
authored andcommitted
Audio: SRC: Add handling for zero size fast_get() allocate
If a non-supported conversion is requested the sizes to allocate and copy are zero. This addition prints a more descriptive error for the situation. Without this change the next null check printed more confusing error "failed to allocate coefficients". Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 632dca3 commit ccc2b74

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/audio/src/src_common.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,14 @@ int src_allocate_copy_stages(struct comp_dev *dev, struct src_param *prm,
621621
coef_size[0] = tap_size * stage_src1->filter_length;
622622
coef_size[1] = tap_size * stage_src2->filter_length;
623623

624+
if (coef_size[0] == 0 || coef_size[1] == 0) {
625+
comp_err(dev,
626+
"illegal zero coefficient vector size for unsupported conversion request %d to %d",
627+
prm->in_fs[prm->idx_in], prm->out_fs[prm->idx_out]);
628+
rfree(stage_dst);
629+
return -EINVAL;
630+
}
631+
624632
stage_dst[0].coefs = fast_get(stage_src1->coefs, coef_size[0]);
625633
stage_dst[1].coefs = fast_get(stage_src2->coefs, coef_size[1]);
626634

0 commit comments

Comments
 (0)