staging:iio:dummy: Fix potential NULL pointer dereference
authorLars-Peter Clausen <lars@metafoo.de>
Wed, 12 Sep 2012 11:06:00 +0000 (12:06 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 22 Sep 2012 09:55:08 +0000 (10:55 +0100)
If the config contains CONFIG_IIO_BUFFER=y and CONFIG_IIO_SIMPLE_DUMMY_BUFFER=n
iio_simple_dummy_configure_buffer() is stubbed out and iio_buffer_register() is
not. As a result we try to register a buffer which has not been configured.
This will causes a NULL pointer deref in iio_buffer_register. To solve this
issue move the iio_buffer_register() call to iio_simple_dummy_configure_buffer(),
so it will only be called if iio_simple_dummy_configure_buffer() has been called.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

No differences found