[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1387521591-15262-1-git-send-email-Li.Xiubo@freescale.com>
Date: Fri, 20 Dec 2013 14:39:50 +0800
From: Xiubo Li <Li.Xiubo@...escale.com>
To: <broonie@...nel.org>, <perex@...ex.cz>, <tiwai@...e.de>,
<kuninori.morimoto.gx@...esas.com>
CC: <fabio.estevam@...escale.com>, <alsa-devel@...a-project.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH] 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: Xiubo Li <Li.Xiubo@...escale.com>
---
sound/soc/generic/simple-card.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 3d190d0..1d87db8 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -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) +
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists