lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1305680634-10484-1-git-send-email-thutt@chromium.org>
Date:	Tue, 17 May 2011 18:03:54 -0700
From:	Taylor Hutt <thutt@...omium.org>
To:	Peter Hsiang <peter.hsiang@...im-ic.com>
Cc:	Liam Girdwood <lrg@...mlogic.co.uk>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
	Taylor Hutt <thutt@...omium.org>, alsa-devel@...a-project.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] Max98095: Move existing NULL check before pointer dereference.

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@...omium.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ