alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
@ 2016-05-03  7:42 Dan Carpenter
  2016-05-03  7:58 ` Takashi Sakamoto
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2016-05-03  7:42 UTC (permalink / raw)
  To: Liam Girdwood, Subhransu S. Prusty
  Cc: alsa-devel, Arnd Bergmann, Vinod Koul, linux-kernel,
	kernel-janitors, Takashi Iwai, Mark Brown, Jeeja KP,
	Sudip Mukherjee

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 <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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-03 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
2016-05-03  7:58 ` Takashi Sakamoto
2016-05-03  9:56 ` Vinod Koul
2016-05-03 16:06   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).