All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Jeeja KP <jeeja.kp@intel.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
Date: Tue, 3 May 2016 15:26:39 +0530	[thread overview]
Message-ID: <20160503095639.GS2274@localhost> (raw)
In-Reply-To: <20160503074258.GA9722@mwanda>

On Tue, May 03, 2016 at 10:42:58AM +0300, Dan Carpenter wrote:
> We intended || here instead of &&.  The original code potentially leads
> to a NULL dereference.

This looks good to me, I will test this and get back

> 
> Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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;

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>, Jeeja KP <jeeja.kp@intel.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Arnd Bergmann <arnd@arndb.de>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
Date: Tue, 03 May 2016 09:50:58 +0000	[thread overview]
Message-ID: <20160503095639.GS2274@localhost> (raw)
In-Reply-To: <20160503074258.GA9722@mwanda>

On Tue, May 03, 2016 at 10:42:58AM +0300, Dan Carpenter wrote:
> We intended || here instead of &&.  The original code potentially leads
> to a NULL dereference.

This looks good to me, I will test this and get back

> 
> Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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;

-- 
~Vinod

  parent reply	other threads:[~2016-05-03  9:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
2016-05-03  7:42 ` Dan Carpenter
2016-05-03  7:42 ` Dan Carpenter
2016-05-03  7:58 ` Takashi Sakamoto
2016-05-03  7:58   ` Takashi Sakamoto
2016-05-03  7:58   ` Takashi Sakamoto
2016-05-03  9:50 ` Vinod Koul [this message]
2016-05-03  9:56   ` Vinod Koul
2016-05-03 16:06   ` Vinod Koul
2016-05-03 16:18     ` Vinod Koul
2016-05-03 16:31 ` Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree Mark Brown
2016-05-03 16:31   ` Mark Brown
2016-05-03 16:31   ` 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=20160503095639.GS2274@localhost \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=jeeja.kp@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=subhransu.s.prusty@intel.com \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=tiwai@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.