diff mbox

ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap

Message ID 1460942188-31274-1-git-send-email-libin.yang@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

libin.yang@linux.intel.com April 18, 2016, 1:16 a.m. UTC
From: Libin Yang <libin.yang@linux.intel.com>

Make sure per_pin is not NULL before using it.

Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
---
 sound/pci/hda/patch_hdmi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Takashi Iwai April 18, 2016, 5:28 a.m. UTC | #1
On Mon, 18 Apr 2016 03:16:28 +0200,
libin.yang@linux.intel.com wrote:
> 
> From: Libin Yang <libin.yang@linux.intel.com>
> 
> Make sure per_pin is not NULL before using it.
> 
> Signed-off-by: Libin Yang <libin.yang@linux.intel.com>

Applied, thanks.


Takashi

> ---
>  sound/pci/hda/patch_hdmi.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 4833c7b..c99289d 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -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));
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4833c7b..c99289d 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -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));