diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2011-02-24 15:34:50 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-28 22:40:22 (GMT) |
commit | 065896e904eac598bafd5e607b944da34c4aaf09 (patch) | |
tree | 1bf9e3d502a84c8219335f1ed2aae79a9216f6da /drivers/staging/iio | |
parent | 7c31b984c4d119d0e32a1696fd4ca6b506a73d10 (diff) | |
download | linux-fsl-qoriq-065896e904eac598bafd5e607b944da34c4aaf09.tar.xz |
IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference
In case optarg n is not given return/exit
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/Documentation/generic_buffer.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 771b236..3cc18ab 100644 --- a/drivers/staging/iio/Documentation/generic_buffer.c +++ b/drivers/staging/iio/Documentation/generic_buffer.c @@ -168,6 +168,9 @@ int main(int argc, char **argv) } } + if (device_name == NULL) + return -1; + /* Find the device requested */ dev_num = find_type_by_name(device_name, "device"); if (dev_num < 0) { |