From: Michael Hennerich <[email protected]>

In case optarg n is not given return/exit

Signed-off-by: Michael Hennerich <[email protected]>
Acked-by: Jonathan Cameron <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 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) {
-- 
1.7.4.1

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to