staging: comedi: check comedi_auto_config() params
authorIan Abbott <abbotti@mev.co.uk>
Thu, 4 Apr 2013 13:58:42 +0000 (14:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Apr 2013 21:33:16 +0000 (14:33 -0700)
Do some minimal error checking of the parameters of
`comedi_auto_config()`.  Just make sure the `hardware_device` and
`driver` parameters are non-NULL.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers.c

index 4724f275830cfe216a0dbde50d91bf60a6758ced..4460814d5344c4e0289bd7d13495ecccd8b29ad4 100644 (file)
@@ -410,6 +410,16 @@ int comedi_auto_config(struct device *hardware_device,
        struct comedi_device *comedi_dev;
        int ret;
 
+       if (!hardware_device) {
+               pr_warn("BUG! comedi_auto_config called with NULL hardware_device\n");
+               return -EINVAL;
+       }
+       if (!driver) {
+               dev_warn(hardware_device,
+                        "BUG! comedi_auto_config called with NULL comedi driver\n");
+               return -EINVAL;
+       }
+
        if (!driver->auto_attach) {
                dev_warn(hardware_device,
                         "BUG! comedi driver '%s' has no auto_attach handler\n",
This page took 0.025408 seconds and 5 git commands to generate.