mirror of https://github.com/thesofproject/sof.git
testbench: topology:check array size mismatch in filewrite component
This patch uses the functionality added by the c9e090ccf3
commit
to check for array size mismatch in components.
Since, the components are in places other than tplg_parser, the
function which checks for the mismatch has been made an external
function from a static one. The function declaration has been
added to the tplg_parser header files, so that the function can
be used by any code which needs array size checks in components.
Signed-off-by: Mohana Datta Yelugoti <ymdatta.work@gmail.com>
This commit is contained in:
parent
6c14e76c0d
commit
d9712ef671
|
@ -240,6 +240,12 @@ static int tplg_load_filewrite(int comp_id, int pipeline_id, int size,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!is_valid_priv_size(total_array_size, size, array)) {
|
||||
fprintf(stderr, "error: filewrite array size mismatch\n");
|
||||
free(array);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tplg_read_array(array, file);
|
||||
|
||||
ret = sof_parse_tokens(&filewrite->config, comp_tokens,
|
||||
|
|
|
@ -269,5 +269,7 @@ int load_widget(void *dev, int dev_type, struct comp_info *temp_comp_list,
|
|||
|
||||
void register_comp(int comp_type);
|
||||
int find_widget(struct comp_info *temp_comp_list, int count, char *name);
|
||||
bool is_valid_priv_size(size_t size_read, size_t priv_size,
|
||||
struct snd_soc_tplg_vendor_array *array);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,7 @@ static enum sof_comp_type find_process_comp_type(enum sof_ipc_process_type type)
|
|||
return SOF_COMP_NONE;
|
||||
}
|
||||
|
||||
static bool is_valid_priv_size(size_t size_read, size_t priv_size,
|
||||
bool is_valid_priv_size(size_t size_read, size_t priv_size,
|
||||
struct snd_soc_tplg_vendor_array *array)
|
||||
{
|
||||
size_t arr_size, elem_size, arr_elems_size;
|
||||
|
|
Loading…
Reference in New Issue