summaryrefslogtreecommitdiff
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/input/tablet
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/acecad.c2
-rw-r--r--drivers/input/tablet/aiptek.c2
-rw-r--r--drivers/input/tablet/hanwang.c2
-rw-r--r--drivers/input/tablet/kbtab.c2
-rw-r--r--drivers/input/tablet/pegasus_notetaker.c2
-rw-r--r--drivers/input/tablet/wacom_serial4.c2
6 files changed, 6 insertions, 6 deletions
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index 0ac16f32b31f..6f39938d5bbc 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -129,7 +129,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(dev, pipe);
- acecad = kzalloc(sizeof(*acecad), GFP_KERNEL);
+ acecad = kzalloc_obj(*acecad, GFP_KERNEL);
input_dev = input_allocate_device();
if (!acecad || !input_dev) {
err = -ENOMEM;
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 2b3fbb0455d5..df9ed01dcdb3 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1673,7 +1673,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
*/
speeds[0] = programmableDelay;
- aiptek = kzalloc(sizeof(*aiptek), GFP_KERNEL);
+ aiptek = kzalloc_obj(*aiptek, GFP_KERNEL);
inputdev = input_allocate_device();
if (!aiptek || !inputdev) {
dev_warn(&intf->dev,
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index 42c1e5eaddd5..264cb9c6e807 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -322,7 +322,7 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
return -ENODEV;
- hanwang = kzalloc(sizeof(*hanwang), GFP_KERNEL);
+ hanwang = kzalloc_obj(*hanwang, GFP_KERNEL);
input_dev = input_allocate_device();
if (!hanwang || !input_dev) {
error = -ENOMEM;
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 794caa102909..658cf6c144bb 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -121,7 +121,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
if (!usb_endpoint_is_int_in(endpoint))
return -ENODEV;
- kbtab = kzalloc(sizeof(*kbtab), GFP_KERNEL);
+ kbtab = kzalloc_obj(*kbtab, GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbtab || !input_dev)
goto fail1;
diff --git a/drivers/input/tablet/pegasus_notetaker.c b/drivers/input/tablet/pegasus_notetaker.c
index eabb4a0b8a0d..8ba71855421b 100644
--- a/drivers/input/tablet/pegasus_notetaker.c
+++ b/drivers/input/tablet/pegasus_notetaker.c
@@ -293,7 +293,7 @@ static int pegasus_probe(struct usb_interface *intf,
endpoint = &intf->cur_altsetting->endpoint[0].desc;
- pegasus = kzalloc(sizeof(*pegasus), GFP_KERNEL);
+ pegasus = kzalloc_obj(*pegasus, GFP_KERNEL);
input_dev = input_allocate_device();
if (!pegasus || !input_dev) {
error = -ENOMEM;
diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c
index cf7cea77dabc..218eb157288b 100644
--- a/drivers/input/tablet/wacom_serial4.c
+++ b/drivers/input/tablet/wacom_serial4.c
@@ -521,7 +521,7 @@ static int wacom_connect(struct serio *serio, struct serio_driver *drv)
struct input_dev *input_dev;
int err = -ENOMEM;
- wacom = kzalloc(sizeof(*wacom), GFP_KERNEL);
+ wacom = kzalloc_obj(*wacom, GFP_KERNEL);
input_dev = input_allocate_device();
if (!wacom || !input_dev)
goto free_device;