Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd41e0c4 authored by Xiubo Li's avatar Xiubo Li Committed by Mark Brown
Browse files

ASoC: simple-card: Add cpu_dai and codec_dai names NULL check



The name of cpu DAI maybe omitted, and then strlen() will lead
kernel panic.

Signed-off-by: default avatarXiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent fa558c28
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
	if (ret < 0)
		return ret;

	if (!info->cpu_dai.name || !info->codec_dai.name)
		return -EINVAL;

	/* card name is created from CPU/CODEC dai name */
	name = devm_kzalloc(dev,
			    strlen(info->cpu_dai.name)   +