Skip to contentSkip to conversation

ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap

PATCH Applied [email protected] 2 participants 2 messages Apr 18, 2016 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap

From: Libin Yang <[email protected]>

Make sure per_pin is not NULL before using it.

---
 sound/pci/hda/patch_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/patch_hdmi.c +2 -0
index 4833c7b..c99289d 100644
@@ -1858,6 +1858,8 @@ static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
+	if (!per_pin)
+		return;
 	mutex_lock(&per_pin->lock);
 	per_pin->chmap_set = true;
 	memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap));
Signature · 1 line
1.9.1
Applied
#1 lore raw
Quoted 6 lines · On Mon, 18 Apr 2016 03:16:28 +0200, [email protected] wrote:

From: Libin Yang <[email protected]>

Make sure per_pin is not NULL before using it.

Applied, thanks.

Takashi

Quoted 20 lines
---
 sound/pci/hda/patch_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/patch_hdmi.c +2 -0
index 4833c7b..c99289d 100644
@@ -1858,6 +1858,8 @@ static void hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
 	struct hdmi_spec *spec = codec->spec;
 	struct hdmi_spec_per_pin *per_pin = pcm_idx_to_pin(spec, pcm_idx);
 
+	if (!per_pin)
+		return;
 	mutex_lock(&per_pin->lock);
 	per_pin->chmap_set = true;
 	memcpy(per_pin->chmap, chmap, ARRAY_SIZE(per_pin->chmap));
Signature · 1 line
1.9.1