Unverified Commit eb2d6774 authored by Niranjan H Y's avatar Niranjan H Y Committed by Mark Brown
Browse files

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: default avatarNiranjan H Y <niranjan.hy@ti.com>
Reviewed-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251110152646.192-1-niranjan.hy@ti.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 29528c8e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -894,7 +894,8 @@ static int find_sdca_entity_control(struct device *dev, struct sdca_entity *enti
		return ret;
	}

	control->values = devm_kzalloc(dev, hweight64(control->cn_list), GFP_KERNEL);
	control->values = devm_kcalloc(dev, hweight64(control->cn_list),
				       sizeof(int), GFP_KERNEL);
	if (!control->values)
		return -ENOMEM;