Skip to content

Commit

Permalink
Input: move from strlcpy with unused retval to strscpy
Browse files Browse the repository at this point in the history
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Signed-off-by: Wolfram Sang <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
[[email protected]: Imported into input-wacom (a9f08ad7adb3)
Signed-off-by: Jason Gerecke <[email protected]>
  • Loading branch information
Wolfram Sang authored and jigpu committed May 2, 2024
1 parent d5c02aa commit 9dbad44
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 4.5/wacom_w8001.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv)
/* For backwards-compatibility we compose the basename based on
* capabilities and then just append the tool type
*/
strlcpy(basename, "Wacom Serial", sizeof(basename));
strscpy(basename, "Wacom Serial", sizeof(basename));

err_pen = w8001_setup_pen(w8001, basename, sizeof(basename));
err_touch = w8001_setup_touch(w8001, basename, sizeof(basename));
Expand All @@ -635,7 +635,7 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv)
}

if (!err_pen) {
strlcpy(w8001->pen_name, basename, sizeof(w8001->pen_name));
strscpy(w8001->pen_name, basename, sizeof(w8001->pen_name));
strlcat(w8001->pen_name, " Pen", sizeof(w8001->pen_name));
input_dev_pen->name = w8001->pen_name;

Expand All @@ -651,7 +651,7 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv)
}

if (!err_touch) {
strlcpy(w8001->touch_name, basename, sizeof(w8001->touch_name));
strscpy(w8001->touch_name, basename, sizeof(w8001->touch_name));
strlcat(w8001->touch_name, " Finger",
sizeof(w8001->touch_name));
input_dev_touch->name = w8001->touch_name;
Expand Down

0 comments on commit 9dbad44

Please sign in to comment.