Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393130

[patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
Date 2016-05-03 09:50 +0200
Message-ID <ruDfI-3LT-39@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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;

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[patch] ASoC: hdac_hdmi: Potential NULL deref in  hdac_hdmi_get_spk_alloc() Dan Carpenter <dan.carpenter@oracle.com> - 2016-05-03 09:50 +0200
  Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in  hdac_hdmi_get_spk_alloc() Takashi Sakamoto <o-takashi@sakamocchi.jp> - 2016-05-03 10:10 +0200
  Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in  hdac_hdmi_get_spk_alloc() Vinod Koul <vinod.koul@intel.com> - 2016-05-03 12:00 +0200
    Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in  hdac_hdmi_get_spk_alloc() Vinod Koul <vinod.koul@intel.com> - 2016-05-03 18:10 +0200
  Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree Mark Brown <broonie@kernel.org> - 2016-05-03 18:40 +0200

csiph-web