* [PATCH] Input: tablet - use sizeof(*pointer) instead of sizeof(type)
@ 2024-06-02 17:10 Erick Archer
2024-06-03 4:39 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Erick Archer @ 2024-06-02 17:10 UTC (permalink / raw)
To: Dmitry Torokhov, Julian Squires, Hans de Goede, Kees Cook,
Gustavo A. R. Silva, Justin Stitt
Cc: Erick Archer, linux-input, linux-kernel, linux-hardening
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter). This patch has no effect
on runtime behavior.
Signed-off-by: Erick Archer <erick.archer@outlook.com>
---
drivers/input/tablet/acecad.c | 2 +-
drivers/input/tablet/aiptek.c | 2 +-
drivers/input/tablet/hanwang.c | 2 +-
drivers/input/tablet/kbtab.c | 2 +-
drivers/input/tablet/wacom_serial4.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index b20e5a1afbcc..0ac16f32b31f 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(struct usb_acecad), GFP_KERNEL);
+ acecad = kzalloc(sizeof(*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 baabc51547b8..2d176fbab251 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(struct aiptek), GFP_KERNEL);
+ aiptek = kzalloc(sizeof(*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 9bc631518b92..42c1e5eaddd5 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(struct hanwang), GFP_KERNEL);
+ hanwang = kzalloc(sizeof(*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 aa577898e952..38d36d25f6f4 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(struct kbtab), GFP_KERNEL);
+ kbtab = kzalloc(sizeof(*kbtab), GFP_KERNEL);
input_dev = input_allocate_device();
if (!kbtab || !input_dev)
goto fail1;
diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c
index 1cedb45ba497..cf7cea77dabc 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(struct wacom), GFP_KERNEL);
+ wacom = kzalloc(sizeof(*wacom), GFP_KERNEL);
input_dev = input_allocate_device();
if (!wacom || !input_dev)
goto free_device;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: tablet - use sizeof(*pointer) instead of sizeof(type)
2024-06-02 17:10 [PATCH] Input: tablet - use sizeof(*pointer) instead of sizeof(type) Erick Archer
@ 2024-06-03 4:39 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2024-06-03 4:39 UTC (permalink / raw)
To: Erick Archer
Cc: Julian Squires, Hans de Goede, Kees Cook, Gustavo A. R. Silva,
Justin Stitt, linux-input, linux-kernel, linux-hardening
On Sun, Jun 02, 2024 at 07:10:47PM +0200, Erick Archer wrote:
> It is preferred to use sizeof(*pointer) instead of sizeof(type)
> due to the type of the variable can change and one needs not
> change the former (unlike the latter). This patch has no effect
> on runtime behavior.
>
> Signed-off-by: Erick Archer <erick.archer@outlook.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-03 4:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-02 17:10 [PATCH] Input: tablet - use sizeof(*pointer) instead of sizeof(type) Erick Archer
2024-06-03 4:39 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).