From: Xiubo Li <Li.Xiubo@freescale.com>
To: <broonie@kernel.org>, <perex@perex.cz>, <tiwai@suse.de>,
<kuninori.morimoto.gx@renesas.com>
Cc: <fabio.estevam@freescale.com>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
Date: Fri, 20 Dec 2013 14:39:50 +0800 [thread overview]
Message-ID: <1387521591-15262-1-git-send-email-Li.Xiubo@freescale.com> (raw)
The name of cpu DAI maybe omitted, and then strlen() will lead
kernel panic.
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.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
next reply other threads:[~2013-12-20 7:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 6:39 Xiubo Li [this message]
2013-12-20 6:39 ` [PATCH] ASoC: soc-core: Fix the DAI name getting Xiubo Li
2013-12-31 16:30 ` Mark Brown
2013-12-21 14:42 ` [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387521591-15262-1-git-send-email-Li.Xiubo@freescale.com \
--to=li.xiubo@freescale.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=fabio.estevam@freescale.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®