Skip to content

Commit

Permalink
IIO: Documentation: generic_buffer example: Avoid NULL pointer derefe…
Browse files Browse the repository at this point in the history
…rence

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>
  • Loading branch information
Michael Hennerich authored and Greg Kroah-Hartman committed Feb 28, 2011
1 parent 7c31b98 commit 065896e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/iio/Documentation/generic_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 065896e

Please sign in to comment.