mirror of https://github.com/thesofproject/sof.git
trace: don't copy uninitialized field from dma_sw_elem parameter
Coverity issue: 254842 Uninitialized scalar variable The variable will contain an arbitrary value left from earlier computations. In parse_page_descriptors: Use of an uninitialized variable (CWE-457) The elem.src variable is not initialized, but in dma_trace_host_buffer() the code reads this initialized value. Break *e = *elem; in e->dest = elem->dest; e->size = elem->size; to only access relevant fields. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This commit is contained in:
parent
8440ec3f18
commit
97e4232f7f
|
@ -185,7 +185,10 @@ int dma_trace_host_buffer(struct dma_trace_data *d, struct dma_sg_elem *elem,
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
*e = *elem;
|
/* copy fields - excluding possibly non-initialized elem->src */
|
||||||
|
e->dest = elem->dest;
|
||||||
|
e->size = elem->size;
|
||||||
|
|
||||||
d->host_size = host_size;
|
d->host_size = host_size;
|
||||||
|
|
||||||
list_item_append(&e->list, &d->config.elem_list);
|
list_item_append(&e->list, &d->config.elem_list);
|
||||||
|
|
Loading…
Reference in New Issue