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: MMI-PSA29.97-13-9~20521^2~404 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=065896e904eac598bafd5e607b944da34c4aaf09;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.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) {