public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: staging: iio: adc: fix uninitialized use
@ 2011-07-03  1:47 Chris Forbes
  2011-07-04  9:01 ` Jonathan Cameron
  2011-07-06  3:36 ` [PATCH] drivers: staging: iio: adc: fix uninitialized use Greg KH
  0 siblings, 2 replies; 24+ messages in thread
From: Chris Forbes @ 2011-07-03  1:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel, Chris Forbes

Fixed an uninitialized variable access. In the first two error paths in
max1363_probe(), 'st' is not yet initialized, but its 'reg' member is
accessed anyway. This would most likely crash.

The intended value for st->reg *is* available at that point in 'reg',
so just use that directly.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
---
 drivers/staging/iio/adc/max1363_core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/iio/adc/max1363_core.c b/drivers/staging/iio/adc/max1363_core.c
index 98cebd2..ebecf14 100644
--- a/drivers/staging/iio/adc/max1363_core.c
+++ b/drivers/staging/iio/adc/max1363_core.c
@@ -1335,11 +1335,11 @@ error_free_device:
 	else
 		iio_device_unregister(indio_dev);
 error_disable_reg:
-	if (!IS_ERR(st->reg))
-		regulator_disable(st->reg);
+	if (!IS_ERR(reg))
+		regulator_disable(reg);
 error_put_reg:
-	if (!IS_ERR(st->reg))
-		regulator_put(st->reg);
+	if (!IS_ERR(reg))
+		regulator_put(reg);
 
 	return ret;
 }
-- 
1.7.4.1


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

end of thread, other threads:[~2011-07-06  4:01 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-03  1:47 [PATCH] drivers: staging: iio: adc: fix uninitialized use Chris Forbes
2011-07-04  9:01 ` Jonathan Cameron
2011-07-04  9:10   ` Dan Carpenter
2011-07-04  9:45     ` Jonathan Cameron
2011-07-04 15:34       ` Greg KH
2011-07-05 16:42         ` [PATCH 00/14] MAINTAINERS: Add staging Joe Perches
2011-07-05 16:42           ` [PATCH 01/14] MAINTAINERS: Add STAGING - ASUS OLED Joe Perches
2011-07-05 16:42           ` [PATCH 02/14] MAINTAINERS: Add STAGING - COMEDI Joe Perches
2011-07-05 16:42           ` [PATCH 03/14] MAINTAINERS: Add STAGING - CRYSTAL HD VIDEO DECODER Joe Perches
2011-07-05 16:42           ` [PATCH 04/14] MAINTAINERS: Add STAGING - ECHO CANCELLER Joe Perches
2011-07-05 16:42           ` [PATCH 05/14] MAINTAINERS: Add STAGING - FRONTIER TRANZPORT AND ALPHATRACK Joe Perches
2011-07-05 16:42           ` [PATCH 06/14] MAINTAINERS: Add STAGING - HYPER-V (MICROSOFT) Joe Perches
2011-07-05 16:42           ` [PATCH 07/14] MAINTAINERS: Add STAGING - INDUSTRIAL IO Joe Perches
2011-07-05 16:42           ` [PATCH 08/14] MAINTAINERS: Add STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER Joe Perches
2011-07-05 16:42           ` [PATCH 09/14] MAINTAINERS: Add STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER Joe Perches
2011-07-05 16:42           ` [PATCH 10/14] MAINTAINERS: Add STAGING - VIA VT665X DRIVERS Joe Perches
2011-07-05 16:42           ` [PATCH 11/14] MAINTAINERS: Add STAGING - WINBOND IS89C35 WLAN USB DRIVER Joe Perches
2011-07-05 16:42           ` [PATCH 12/14] MAINTAINERS: Add STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS Joe Perches
2011-07-05 16:42           ` [PATCH 13/14] MAINTAINERS: Add STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER Joe Perches
2011-07-05 16:42           ` [PATCH 14/14] MAINTAINERS: Remove se401 entry Joe Perches
2011-07-05 16:54           ` [PATCH 00/14] MAINTAINERS: Add staging Greg KH
2011-07-06  3:36 ` [PATCH] drivers: staging: iio: adc: fix uninitialized use Greg KH
2011-07-06  3:57   ` Chris Forbes
2011-07-06  4:01     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox