Skip to content

Commit eb2d677

Browse files
niranjanhytibroonie
authored andcommitted
ASoC: SDCA: bug fix while parsing mipi-sdca-control-cn-list
"struct sdca_control" declares "values" field as integer array. But the memory allocated to it is of char array. This causes crash for sdca_parse_function API. This patch addresses the issue by allocating correct data size. Signed-off-by: Niranjan H Y <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 29528c8 commit eb2d677

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/sdca/sdca_functions.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,8 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
894894
return ret;
895895
}
896896

897-
control->values = devm_kzalloc(dev, hweight64(control->cn_list), GFP_KERNEL);
897+
control->values = devm_kcalloc(dev, hweight64(control->cn_list),
898+
sizeof(int), GFP_KERNEL);
898899
if (!control->values)
899900
return -ENOMEM;
900901

0 commit comments

Comments
 (0)