aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-steam.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2022-08-18 23:00:09 +0200
committerJiri Kosina <jkosina@suse.cz>2022-08-25 11:44:27 +0200
commiteeeec27d68204701cc5d49d79f7ba811e8438109 (patch)
tree22f82012929ce6cc92535e6e52647540d229314d /drivers/hid/hid-steam.c
parentHID: Kconfig: remove redundant "depends on HID" lines (diff)
downloadlinux-dev-eeeec27d68204701cc5d49d79f7ba811e8438109.tar.xz
linux-dev-eeeec27d68204701cc5d49d79f7ba811e8438109.zip
HID: move from strlcpy with unused retval to strscpy
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. Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-steam.c')
-rw-r--r--drivers/hid/hid-steam.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index a3b151b29bd7..f675e1aa08c9 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -246,7 +246,7 @@ static int steam_get_serial(struct steam_device *steam)
if (reply[0] != 0xae || reply[1] != 0x15 || reply[2] != 0x01)
return -EIO;
reply[3 + STEAM_SERIAL_LEN] = 0;
- strlcpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
+ strscpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
return 0;
}
@@ -514,7 +514,7 @@ static int steam_register(struct steam_device *steam)
*/
mutex_lock(&steam->mutex);
if (steam_get_serial(steam) < 0)
- strlcpy(steam->serial_no, "XXXXXXXXXX",
+ strscpy(steam->serial_no, "XXXXXXXXXX",
sizeof(steam->serial_no));
mutex_unlock(&steam->mutex);
@@ -689,9 +689,9 @@ static struct hid_device *steam_create_client_hid(struct hid_device *hdev)
client_hdev->version = hdev->version;
client_hdev->type = hdev->type;
client_hdev->country = hdev->country;
- strlcpy(client_hdev->name, hdev->name,
+ strscpy(client_hdev->name, hdev->name,
sizeof(client_hdev->name));
- strlcpy(client_hdev->phys, hdev->phys,
+ strscpy(client_hdev->phys, hdev->phys,
sizeof(client_hdev->phys));
/*
* Since we use the same device info than the real interface to