From: Ian Abbott Date: Thu, 4 Apr 2013 13:58:42 +0000 (+0100) Subject: staging: comedi: check comedi_auto_config() params X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=f08e0ac59a93db2d8abc7000e2647164104524c6;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: check comedi_auto_config() params 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 Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 4724f275830c..4460814d5344 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -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",