From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Date: Tue, 3 May 2016 10:42:58 +0300 Message-ID: <20160503074258.GA9722@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) by alsa0.perex.cz (Postfix) with ESMTP id 661AB2650C0 for ; Tue, 3 May 2016 09:43:20 +0200 (CEST) Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Liam Girdwood , "Subhransu S. Prusty" Cc: alsa-devel@alsa-project.org, Arnd Bergmann , Vinod Koul , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Takashi Iwai , Mark Brown , Jeeja KP , Sudip Mukherjee List-Id: alsa-devel@alsa-project.org We intended || here instead of &&. The original code potentially leads to a NULL dereference. Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops') Signed-off-by: Dan Carpenter diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 3043120..7e7ff1b 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -1609,7 +1609,7 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_pin *pin = pcm->pin; - if (!pin && !pin->eld.eld_valid) + if (!pin || !pin->eld.eld_valid) return 0; return pin->eld.info.spk_alloc;