Skip to contentSkip to conversation

drivers: staging: iio: adc: fix uninitialized use

PATCH In review Chris Forbes 6 participants 24 messages Jul 3, 2011 – Jul 6, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: staging: iio: adc: fix uninitialized use

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.

---
 drivers/staging/iio/adc/max1363_core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/max1363_core.c +4 -4
index 98cebd2..ebecf14 100644
@@ -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;
 }
Signature · 1 line
1.7.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · 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.

Good spot. Please tech TODO files for staging patches. In this case it would have given you the mailing list, now cc'd.

Quoted 5 lines

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

Quoted 24 lines
---
 drivers/staging/iio/adc/max1363_core.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/iio/adc/max1363_core.c +4 -4
index 98cebd2..ebecf14 100644
@@ -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;
 }
#2 lore raw
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · 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.

Good spot. Please tech TODO files for staging patches. In this case it would have given you the mailing list, now cc'd.

It would better to add an entry to MAINTAINERS so that ./scripts/get_maintainer.pl gave the right lists.

regards,
dan carpenter

#3 lore raw
Quoted 10 lines · Dan Carpenter
Quoted 6 lines · Jonathan Cameron
Quoted 3 lines · 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.

Good spot. Please tech TODO files for staging patches. In this case it would have given you the mailing list, now cc'd.

It would better to add an entry to MAINTAINERS so that ./scripts/get_maintainer.pl gave the right lists.

Perhaps, but Greg KH is anti, so it isn't going to happen.

#4 lore raw
Quoted 6 lines · Jonathan Cameron
Quoted 5 lines · Dan Carpenter
Quoted 4 lines · Jonathan Cameron
Quoted 3 lines · 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.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Good spot. Please tech TODO files for staging patches. In this case it would have given you the mailing list, now cc'd.

It would better to add an entry to MAINTAINERS so that ./scripts/get_maintainer.pl gave the right lists.

Perhaps, but Greg KH is anti, so it isn't going to happen.

I'm coming around on this, for larger chunks of code, like iio, I don't mind it, so feel free to send me an entry.

thanks,

greg k-h

#5 lore raw

cover MAINTAINERS: Add staging

If you've changed your mind, here are the parts that apply from the original submission in June, 2010.

Added a removal of one deleted section as well.

Joe Perches (14):
MAINTAINERS: Add STAGING - ASUS OLED
MAINTAINERS: Add STAGING - COMEDI
MAINTAINERS: Add STAGING - CRYSTAL HD VIDEO DECODER
MAINTAINERS: Add STAGING - ECHO CANCELLER
MAINTAINERS: Add STAGING - FRONTIER TRANZPORT AND ALPHATRACK
MAINTAINERS: Add STAGING - HYPER-V (MICROSOFT)
MAINTAINERS: Add STAGING - INDUSTRIAL IO
MAINTAINERS: Add STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER
MAINTAINERS: Add STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER
MAINTAINERS: Add STAGING - VIA VT665X DRIVERS
MAINTAINERS: Add STAGING - WINBOND IS89C35 WLAN USB DRIVER
MAINTAINERS: Add STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS
MAINTAINERS: Add STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
MAINTAINERS: Remove se401 entry

 MAINTAINERS |   79 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 72 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.6.131.g99019
#6 lore raw

PATCH 1/14 MAINTAINERS: Add STAGING - ASUS OLED

---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 7fe708d..6f0d683 100644
@@ -6069,6 +6069,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/staging/
 
+STAGING - ASUS OLED
+M:	Jakub Schmidtke <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/asus_oled/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#7 lore raw

PATCH 2/14 MAINTAINERS: Add STAGING - COMEDI

In reply to Joe Perches
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index 6f0d683..6d8e58b 100644
@@ -6074,6 +6074,12 @@ M:	Jakub Schmidtke <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/asus_oled/
 
+STAGING - COMEDI
+M:	Ian Abbott <[email protected]>
+M:	Mori Hess <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/comedi/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#8 lore raw

PATCH 3/14 MAINTAINERS: Add STAGING - CRYSTAL HD VIDEO DECODER

In reply to Joe Perches
---
 MAINTAINERS |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +8 -0
index 6d8e58b..e42923b 100644
@@ -6080,6 +6080,14 @@ M:	Mori Hess <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/comedi/
 
+STAGING - CRYSTAL HD VIDEO DECODER
+M:	Naren Sankar <[email protected]>
+M:	Jarod Wilson <[email protected]>
+M:	Scott Davilla <[email protected]>
+M:	Manu Abraham <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/crystalhd/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#9 lore raw

PATCH 4/14 MAINTAINERS: Add STAGING - ECHO CANCELLER

In reply to Joe Perches
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index e42923b..320fd7c 100644
@@ -6088,6 +6088,12 @@ M:	Manu Abraham <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/crystalhd/
 
+STAGING - ECHO CANCELLER
+M:	Steve Underwood <[email protected]>
+M:	David Rowe <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/echo/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#10 lore raw

PATCH 5/14 MAINTAINERS: Add STAGING - FRONTIER TRANZPORT AND ALPHATRACK

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 320fd7c..9c7baa9 100644
@@ -6094,6 +6094,11 @@ M:	David Rowe <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/echo/
 
+STAGING - FRONTIER TRANZPORT AND ALPHATRACK
+M:	David Täht <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/frontier/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#11 lore raw

PATCH 6/14 MAINTAINERS: Add STAGING - HYPER-V (MICROSOFT)

In reply to Joe Perches
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index 9c7baa9..70ccf25 100644
@@ -6099,6 +6099,12 @@ M:	David Täht <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/frontier/
 
+STAGING - HYPER-V (MICROSOFT)
+M:	Hank Janssen <[email protected]>
+M:	Haiyang Zhang <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/hv/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#12 lore raw

PATCH 7/14 MAINTAINERS: Add STAGING - INDUSTRIAL IO

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 70ccf25..9968b10 100644
@@ -6105,6 +6105,11 @@ M:	Haiyang Zhang <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/hv/
 
+STAGING - INDUSTRIAL IO
+M:	Jonathan Cameron <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/iio/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#13 lore raw

PATCH 8/14 MAINTAINERS: Add STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 9968b10..9cd7ea9 100644
@@ -6110,6 +6110,11 @@ M:	Jonathan Cameron <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/iio/
 
+STAGING -  PARALLEL LCD/KEYPAD PANEL DRIVER
+M:	Willy Tarreau <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/panel/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#14 lore raw

PATCH 9/14 MAINTAINERS: Add STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 9cd7ea9..b0ce557 100644
@@ -6115,6 +6115,11 @@ M:	Willy Tarreau <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/panel/
 
+STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER
+M:	Teddy Wang <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/sm7xx/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#15 lore raw

PATCH 10/14 MAINTAINERS: Add STAGING - VIA VT665X DRIVERS

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index b0ce557..ac25e66 100644
@@ -6120,6 +6120,11 @@ M:	Teddy Wang <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/sm7xx/
 
+STAGING - VIA VT665X DRIVERS
+M:	Forest Bond <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/vt665?/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#16 lore raw

PATCH 11/14 MAINTAINERS: Add STAGING - WINBOND IS89C35 WLAN USB DRIVER

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index ac25e66..cfb22e2 100644
@@ -6125,6 +6125,11 @@ M:	Forest Bond <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/vt665?/
 
+STAGING - WINBOND IS89C35 WLAN USB DRIVER
+M:	Pavel Machek <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/winbond/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#17 lore raw

PATCH 12/14 MAINTAINERS: Add STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS

In reply to Joe Perches
---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index cfb22e2..9ab3703 100644
@@ -6069,6 +6069,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/staging/
 
+STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS
+M:	Henk de Groot <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/wlags49_h2/
+F:	drivers/staging/wlags49_h25/
+
 STAGING - ASUS OLED
 M:	Jakub Schmidtke <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#18 lore raw

PATCH 13/14 MAINTAINERS: Add STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER

In reply to Joe Perches
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 9ab3703..bd46c4f 100644
@@ -6136,6 +6136,11 @@ M:	Pavel Machek <[email protected]>
 S:	Odd Fixes
 F:	drivers/staging/winbond/
 
+STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER
+M:	Arnaud Patard <[email protected]>
+S:	Odd Fixes
+F:	drivers/staging/xgifb/
+
 STARFIRE/DURALAN NETWORK DRIVER
 M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
Signature · 1 line
1.7.6.131.g99019
#19 lore raw

PATCH 14/14 MAINTAINERS: Remove se401 entry

In reply to Joe Perches

Commit b287db119edb ("se401: remove last V4L1 driver") removed the files, remove the entry.

cc Hans Verkuil <[email protected]>
cc Mauro Carvalho Chehab <[email protected]>
---
 MAINTAINERS |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)
MAINTAINERS +0 -7
index bd46c4f..7c11854 100644
@@ -6638,13 +6638,6 @@ W:	http://pegasus2.sourceforge.net/
 S:	Maintained
 F:	drivers/net/usb/rtl8150.c
 
-USB SE401 DRIVER
-L:	[email protected]
-W:	http://www.chello.nl/~j.vreeken/se401/
-S:	Orphan
-F:	Documentation/video4linux/se401.txt
-F:	drivers/staging/se401/
-
 USB SERIAL BELKIN F5U103 DRIVER
 M:	William Greathouse <[email protected]>
 L:	[email protected]
Signature · 1 line
1.7.6.131.g99019
#20 lore raw

Re: [PATCH 00/14] MAINTAINERS: Add staging

In reply to Joe Perches
Quoted 4 lines · Joe Perches

If you've changed your mind, here are the parts that apply from the original submission in June, 2010.

Added a removal of one deleted section as well.

Ah, what the hell, now applied...

#21 lore raw
In reply to Chris Forbes
Quoted 6 lines · 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.

This doesn't apply anymore, care to redo it against the latest staging-next branch and resend?

thanks,

greg k-h

#22 lore raw

Looks one of Dan Carpenter's patches in the staging-next tree -- f88af7e -- already fixes this; disregard my patch.

-- Chris

Quoted 15 lines · Greg KH
Quoted 6 lines · 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.

This doesn't apply anymore, care to redo it against the latest staging-next branch and resend?

thanks,

greg k-h

#23 lore raw
Quoted 2 lines · Chris Forbes

Looks one of Dan Carpenter's patches in the staging-next tree -- f88af7e -- already fixes this; disregard my patch.

Consider it disregarded.