Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751188AbdHXDeo (ORCPT ); Wed, 23 Aug 2017 23:34:44 -0400 Received: from regular1.263xmail.com ([211.150.99.141]:55844 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750715AbdHXDen (ORCPT ); Wed, 23 Aug 2017 23:34:43 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jeffy Chen To: linux-kernel@vger.kernel.org, broonie@kernel.org Cc: tiwai@suse.de, dolinux.peng@gmail.com, Jeffy Chen , Jaroslav Kysela , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood Subject: [PATCH v2] ASoC: Add a sanity check before using dai driver name Date: Thu, 24 Aug 2017 11:34:11 +0800 Message-Id: <20170824033411.5788-1-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 836 Lines: 30 The dai driver's name is allowed to be NULL. So add a sanity check for that. Signed-off-by: Jeffy Chen Reported-by: Donglin Peng --- Changes in v2: Keep the oringinal check style. sound/soc/soc-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index fc1bb2da3e2e..c38c8f844546 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1029,7 +1029,8 @@ struct snd_soc_dai *snd_soc_find_dai( continue; list_for_each_entry(dai, &component->dai_list, list) { if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) - && strcmp(dai->driver->name, dlc->dai_name)) + && (!dai->driver->name + || !strcmp(dai->driver->name, dlc->dai_name)) continue; return dai; -- 2.11.0