From: Michael Hennerich Date: Thu, 24 Feb 2011 15:34:50 +0000 (+0100) Subject: IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference X-Git-Tag: firefly_0821_release~7613^2~2197^2~404 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=065896e904eac598bafd5e607b944da34c4aaf09;p=firefly-linux-kernel-4.4.55.git IIO: Documentation: generic_buffer example: Avoid NULL pointer dereference In case optarg n is not given return/exit Signed-off-by: Michael Hennerich Acked-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/iio/Documentation/generic_buffer.c b/drivers/staging/iio/Documentation/generic_buffer.c index 771b23627797..3cc18ab4ebfd 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) {