All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Max98095: Move existing NULL check before pointer dereference.
@ 2011-05-18  1:03 Taylor Hutt
  2011-05-18  1:28   ` Peter Hsiang
  2011-05-18 16:38   ` Mark Brown
  0 siblings, 2 replies; 9+ messages in thread
From: Taylor Hutt @ 2011-05-18  1:03 UTC (permalink / raw)
  To: Peter Hsiang
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Taylor Hutt, alsa-devel, linux-kernel

Visual inspection shows that max98095_put_eq_enum() and
max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.

This change moves the NULL check above the use.

BUG=none
TEST=Visual inspection
Change-Id: Ic53a7e38a958f39225ac4961bcfd3812a95ea1b5
Signed-off-by: Taylor Hutt <thutt@chromium.org>
---
 sound/soc/codecs/max98095.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index a6cc94e..e1d282d 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -1872,16 +1872,14 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
 
 	BUG_ON(channel > 1);
 
-	cdata = &max98095->dai[channel];
+	if (!pdata || !max98095->eq_textcnt)
+		return 0;
 
 	if (sel >= pdata->eq_cfgcnt)
 		return -EINVAL;
 
+	cdata = &max98095->dai[channel];
 	cdata->eq_sel = sel;
-
-	if (!pdata || !max98095->eq_textcnt)
-		return 0;
-
 	fs = cdata->rate;
 
 	/* Find the selected configuration with nearest sample rate */
@@ -2020,16 +2018,14 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
 
 	BUG_ON(channel > 1);
 
-	cdata = &max98095->dai[channel];
+	if (!pdata || !max98095->bq_textcnt)
+		return 0;
 
 	if (sel >= pdata->bq_cfgcnt)
 		return -EINVAL;
 
+	cdata = &max98095->dai[channel];
 	cdata->bq_sel = sel;
-
-	if (!pdata || !max98095->bq_textcnt)
-		return 0;
-
 	fs = cdata->rate;
 
 	/* Find the selected configuration with nearest sample rate */
-- 
1.7.3.1


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

* RE: [PATCH] Max98095: Move existing NULL check before pointer dereference.
  2011-05-18  1:03 [PATCH] Max98095: Move existing NULL check before pointer dereference Taylor Hutt
@ 2011-05-18  1:28   ` Peter Hsiang
  2011-05-18 16:38   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Hsiang @ 2011-05-18  1:28 UTC (permalink / raw)
  To: Taylor Hutt, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel

On Tue, May 17, 2011, Taylor Hutt wrote:

> Visual inspection shows that max98095_put_eq_enum() and
> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
> 
> This change moves the NULL check above the use.
> 
> BUG=none
> TEST=Visual inspection

Mark, this patch looks good.
Thank you Taylor.


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

* Re: [PATCH] Max98095: Move existing NULL check before pointer dereference.
@ 2011-05-18  1:28   ` Peter Hsiang
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Hsiang @ 2011-05-18  1:28 UTC (permalink / raw)
  To: Taylor Hutt, Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai

On Tue, May 17, 2011, Taylor Hutt wrote:

> Visual inspection shows that max98095_put_eq_enum() and
> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
> 
> This change moves the NULL check above the use.
> 
> BUG=none
> TEST=Visual inspection

Mark, this patch looks good.
Thank you Taylor.

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

* Re: [PATCH] Max98095: Move existing NULL check before pointer dereference.
  2011-05-18  1:28   ` Peter Hsiang
  (?)
@ 2011-05-18  7:06   ` Mark Brown
  2011-05-18 13:53     ` Peter Hsiang
  -1 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2011-05-18  7:06 UTC (permalink / raw)
  To: Peter Hsiang
  Cc: Taylor Hutt, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

On Tue, May 17, 2011 at 06:28:04PM -0700, Peter Hsiang wrote:

> Mark, this patch looks good.

I can add your Acked-by?

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

* Re: [alsa-devel] [PATCH] Max98095: Move existing NULL check before pointer dereference.
  2011-05-18  1:28   ` Peter Hsiang
@ 2011-05-18  9:32     ` Liam Girdwood
  -1 siblings, 0 replies; 9+ messages in thread
From: Liam Girdwood @ 2011-05-18  9:32 UTC (permalink / raw)
  To: Peter Hsiang
  Cc: Taylor Hutt, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel

On 18/05/11 02:28, Peter Hsiang wrote:
> On Tue, May 17, 2011, Taylor Hutt wrote:
> 
>> Visual inspection shows that max98095_put_eq_enum() and
>> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
>>
>> This change moves the NULL check above the use.
>>
>> BUG=none
>> TEST=Visual inspection
> 
> Mark, this patch looks good.
> Thank you Taylor.
> 

Acked-by: Liam Girdwood <lrg@ti.com>

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

* Re: [PATCH] Max98095: Move existing NULL check before pointer dereference.
@ 2011-05-18  9:32     ` Liam Girdwood
  0 siblings, 0 replies; 9+ messages in thread
From: Liam Girdwood @ 2011-05-18  9:32 UTC (permalink / raw)
  To: Peter Hsiang
  Cc: alsa-devel, Takashi Iwai, Mark Brown, linux-kernel, Taylor Hutt,
	Liam Girdwood

On 18/05/11 02:28, Peter Hsiang wrote:
> On Tue, May 17, 2011, Taylor Hutt wrote:
> 
>> Visual inspection shows that max98095_put_eq_enum() and
>> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
>>
>> This change moves the NULL check above the use.
>>
>> BUG=none
>> TEST=Visual inspection
> 
> Mark, this patch looks good.
> Thank you Taylor.
> 

Acked-by: Liam Girdwood <lrg@ti.com>

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

* RE: [PATCH] Max98095: Move existing NULL check before pointer dereference.
  2011-05-18  7:06   ` Mark Brown
@ 2011-05-18 13:53     ` Peter Hsiang
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Hsiang @ 2011-05-18 13:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: Taylor Hutt, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

On Tue, May 17, 2011, Mark Brown wrote:

> On Tue, May 17, 2011 at 06:28:04PM -0700, Peter Hsiang wrote:
> 
> > Mark, this patch looks good.
> 
> I can add your Acked-by?

Ok thanks.

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

* Re: [PATCH] Max98095: Move existing NULL check before pointer dereference.
  2011-05-18  1:03 [PATCH] Max98095: Move existing NULL check before pointer dereference Taylor Hutt
@ 2011-05-18 16:38   ` Mark Brown
  2011-05-18 16:38   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2011-05-18 16:38 UTC (permalink / raw)
  To: Taylor Hutt
  Cc: Peter Hsiang, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

On Tue, May 17, 2011 at 06:03:54PM -0700, Taylor Hutt wrote:
> Visual inspection shows that max98095_put_eq_enum() and
> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
> 
> This change moves the NULL check above the use.

Applied, thanks.  Please try to keep your subject line consistent with
the rest of the subsystem.

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

* Re: [PATCH] Max98095: Move existing NULL check before pointer dereference.
@ 2011-05-18 16:38   ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2011-05-18 16:38 UTC (permalink / raw)
  To: Taylor Hutt
  Cc: alsa-devel, Takashi Iwai, linux-kernel, Peter Hsiang, Liam Girdwood

On Tue, May 17, 2011 at 06:03:54PM -0700, Taylor Hutt wrote:
> Visual inspection shows that max98095_put_eq_enum() and
> max98095_put_bq_enum() each have a possible NULL deref of 'pdata'.
> 
> This change moves the NULL check above the use.

Applied, thanks.  Please try to keep your subject line consistent with
the rest of the subsystem.

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

end of thread, other threads:[~2011-05-18 16:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18  1:03 [PATCH] Max98095: Move existing NULL check before pointer dereference Taylor Hutt
2011-05-18  1:28 ` Peter Hsiang
2011-05-18  1:28   ` Peter Hsiang
2011-05-18  7:06   ` Mark Brown
2011-05-18 13:53     ` Peter Hsiang
2011-05-18  9:32   ` [alsa-devel] " Liam Girdwood
2011-05-18  9:32     ` Liam Girdwood
2011-05-18 16:38 ` Mark Brown
2011-05-18 16:38   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.