]> git.karo-electronics.de Git - linux-beck.git/commitdiff
IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference
authorMichael Hennerich <michael.hennerich@analog.com>
Thu, 24 Feb 2011 15:34:50 +0000 (16:34 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 28 Feb 2011 22:40:22 +0000 (14:40 -0800)
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>
drivers/staging/iio/Documentation/generic_buffer.c

index 771b23627797f939e424d485e23ef1515ab57f9f..3cc18ab4ebfd357f347d9e4d48c62c229e002475 100644 (file)
@@ -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) {