haven: Fix NULL pointer dereference in hh_rm_populate_mem_attr_desc()

Use the locally calculated value of memory attribute entries when
populating the memory attribute descriptor, instead of always
dereferencing the client provided memory attribute descriptor,
as clients may not always provide one.

Change-Id: Ifbe586336e69e439ed404067616cce7515fd7953
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres 2020-04-02 12:04:35 -07:00
commit 2629a2e2f1

View file

@ -609,7 +609,7 @@ static void hh_rm_populate_mem_attr_desc(struct hh_mem_attr_desc *dst_desc,
{
u32 n_mem_attr_entries = src_desc ? src_desc->n_mem_attr_entries : 0;
dst_desc->n_mem_attr_entries = src_desc->n_mem_attr_entries;
dst_desc->n_mem_attr_entries = n_mem_attr_entries;
if (n_mem_attr_entries)
memcpy(dst_desc->attr_entries, src_desc->attr_entries,
sizeof(*dst_desc->attr_entries) * n_mem_attr_entries);