From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755449AbcECIEb (ORCPT ); Tue, 3 May 2016 04:04:31 -0400 Received: from smtp303.phy.lolipop.jp ([210.157.22.87]:54397 "EHLO smtp303.phy.lolipop.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbcECIE1 (ORCPT ); Tue, 3 May 2016 04:04:27 -0400 X-Greylist: delayed 376 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 May 2016 04:04:27 EDT Subject: Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() To: Dan Carpenter , Liam Girdwood , "Subhransu S. Prusty" References: <20160503074258.GA9722@mwanda> 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 From: Takashi Sakamoto Message-ID: <57285A0F.7060603@sakamocchi.jp> Date: Tue, 3 May 2016 16:58:07 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160503074258.GA9722@mwanda> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On May 03 2016 16:42, Dan Carpenter wrote: > 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 Indeed. Reviewd-by: Takashi Sakamoto > 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; Regards Takashi Sakamoto