# \[patch\] Input: wacom - check for allocation failure in probe()

- Subsystems: INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS, THE REST
- Maintainers: Dmitry Torokhov, Linus Torvalds
- List: linux-input
- 2 messages, 2 authors
- Page: https://ratatoskr.run/linux-input/2012/03/8919151/t

## \[patch\] Input: wacom - check for allocation failure in probe()

- From: Dan Carpenter \<hidden\>
- Date: 2012-03-27 20:15:29 
- Message: https://ratatoskr.run/linux-input/2012/03/8919151.md

```text
We accidentally removed the check for NULL in 3aac0ef10b "Input: wacom -
isolate input registration".

Signed-off-by: Dan Carpenter <redacted>

diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 19ba586..0d26921 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1002,6 +1002,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
 		return -EINVAL;
 
 	wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
+	if (!wacom)
+		return -ENOMEM;
 
 	wacom_wac = &wacom->wacom_wac;
 	wacom_wac->features = *((struct wacom_features *)id->driver_info);
```

## Re: \[patch\] Input: wacom - check for allocation failure in probe()

- From: Chris Bagwell \<hidden\>
- Date: 2012-03-27 20:39:12 
- Message: https://ratatoskr.run/linux-input/2012/03/8919152.md

```text
Thanks for catch.

Reviewed-by: Chris Bagwell <redacted>

On Tue, Mar 27, 2012 at 3:15 PM, Dan Carpenter [ref] wrote:
> We accidentally removed the check for NULL in 3aac0ef10b "Input: wacom -
> isolate input registration".
>
> Signed-off-by: Dan Carpenter <redacted>
>
> diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
> index 19ba586..0d26921 100644
> --- a/drivers/input/tablet/wacom_sys.c
> +++ b/drivers/input/tablet/wacom_sys.c
> @@ -1002,6 +1002,8 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
>                return -EINVAL;
>
>        wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL);
> +       if (!wacom)
> +               return -ENOMEM;
>
>        wacom_wac = &wacom->wacom_wac;
>        wacom_wac->features = *((struct wacom_features *)id->driver_info);
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
