* [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
@ 2016-03-30 3:08 libin.yang
2016-03-30 4:39 ` Subhransu S. Prusty
0 siblings, 1 reply; 5+ messages in thread
From: libin.yang @ 2016-03-30 3:08 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: libin.yang, mengdong.lin, Libin Yang
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(+)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
2016-03-30 3:08 [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap libin.yang
@ 2016-03-30 4:39 ` Subhransu S. Prusty
2016-03-30 4:55 ` Yang, Libin
0 siblings, 1 reply; 5+ messages in thread
From: Subhransu S. Prusty @ 2016-03-30 4:39 UTC (permalink / raw)
To: libin.yang; +Cc: tiwai, Yang, Libin, alsa-devel, Lin, Mengdong
On Wed, Mar 30, 2016 at 08:38:42AM +0530, libin.yang@linux.intel.com wrote:
> From: Libin Yang <libin.yang@linux.intel.com>
>
> Make sure per_pin is not NULL before using it.
Hi Libin,
In the beginning of ctl_put handler this NULL check is already done.
Are you supposed to call this set_chmap from other places too?
Regards,
Subhransu
>
> Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> ---
> 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
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
2016-03-30 4:39 ` Subhransu S. Prusty
@ 2016-03-30 4:55 ` Yang, Libin
0 siblings, 0 replies; 5+ messages in thread
From: Yang, Libin @ 2016-03-30 4:55 UTC (permalink / raw)
To: Prusty, Subhransu S, libin.yang; +Cc: tiwai, Lin, Mengdong, alsa-devel
Hi Subhransu,
> -----Original Message-----
> From: Prusty, Subhransu S
> Sent: Wednesday, March 30, 2016 12:40 PM
> To: libin.yang@linux.intel.com
> Cc: alsa-devel@alsa-project.org; tiwai@suse.de; Yang, Libin; Lin,
> Mengdong
> Subject: Re: [alsa-devel] [PATCH] ALSA - hda: hdmi check NULL pointer in
> hdmi_set_chmap
>
> On Wed, Mar 30, 2016 at 08:38:42AM +0530, libin.yang@linux.intel.com
> wrote:
> > From: Libin Yang <libin.yang@linux.intel.com>
> >
> > Make sure per_pin is not NULL before using it.
>
> Hi Libin,
>
> In the beginning of ctl_put handler this NULL check is already done.
> Are you supposed to call this set_chmap from other places too?
I made the patch because it is required by the klocwork. It's not a real
bug so far, I think.
Regards,
Libin
>
> Regards,
> Subhransu
> >
> > Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> > ---
> > 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
> >
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel@alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
> --
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
2016-04-18 1:16 libin.yang
@ 2016-04-18 5:28 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2016-04-18 5:28 UTC (permalink / raw)
To: libin.yang; +Cc: libin.yang, mengdong.lin, alsa-devel, liam.r.girdwood
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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap
@ 2016-04-18 1:16 libin.yang
2016-04-18 5:28 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: libin.yang @ 2016-04-18 1:16 UTC (permalink / raw)
To: alsa-devel, tiwai; +Cc: libin.yang, mengdong.lin, Libin Yang, liam.r.girdwood
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(+)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-18 5:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 3:08 [PATCH] ALSA - hda: hdmi check NULL pointer in hdmi_set_chmap libin.yang
2016-03-30 4:39 ` Subhransu S. Prusty
2016-03-30 4:55 ` Yang, Libin
2016-04-18 1:16 libin.yang
2016-04-18 5:28 ` Takashi Iwai
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).