diff mbox series

[v1,1/7] platform/x86: asus-tf103c-dock: Use 2-argument strscpy()

Message ID 20240602090244.1666360-2-andy.shevchenko@gmail.com (mailing list archive)
State New
Headers show
Series platform/x86: Move to 2-argument strscpy() | expand

Commit Message

Andy Shevchenko June 2, 2024, 8:57 a.m. UTC
Use 2-argument strscpy(), which is not only shorter but also provides
an additional check that destination buffer is an array.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/platform/x86/asus-tf103c-dock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Hans de Goede June 2, 2024, 1:28 p.m. UTC | #1
Hi,

On 6/2/24 10:57 AM, Andy Shevchenko wrote:
> Use 2-argument strscpy(), which is not only shorter but also provides
> an additional check that destination buffer is an array.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks, the entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Regards,

Hans




> ---
>  drivers/platform/x86/asus-tf103c-dock.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-tf103c-dock.c b/drivers/platform/x86/asus-tf103c-dock.c
> index 8f0f87637c5f..b441d8ca72d3 100644
> --- a/drivers/platform/x86/asus-tf103c-dock.c
> +++ b/drivers/platform/x86/asus-tf103c-dock.c
> @@ -490,7 +490,7 @@ static void tf103c_dock_enable_touchpad(struct tf103c_dock_data *dock)
>  		return;
>  	}
>  
> -	strscpy(board_info.type, "elan_i2c", I2C_NAME_SIZE);
> +	strscpy(board_info.type, "elan_i2c");
>  	board_info.addr = TF103C_DOCK_TP_ADDR;
>  	board_info.dev_name = TF103C_DOCK_DEV_NAME "-tp";
>  	board_info.irq = dock->tp_irq;
> @@ -795,7 +795,7 @@ static int tf103c_dock_probe(struct i2c_client *client)
>  	 */
>  	dock->ec_client = client;
>  
> -	strscpy(board_info.type, "tf103c-dock-intr", I2C_NAME_SIZE);
> +	strscpy(board_info.type, "tf103c-dock-intr");
>  	board_info.addr = TF103C_DOCK_INTR_ADDR;
>  	board_info.dev_name = TF103C_DOCK_DEV_NAME "-intr";
>  
> @@ -803,7 +803,7 @@ static int tf103c_dock_probe(struct i2c_client *client)
>  	if (IS_ERR(dock->intr_client))
>  		return dev_err_probe(dev, PTR_ERR(dock->intr_client), "creating intr client\n");
>  
> -	strscpy(board_info.type, "tf103c-dock-kbd", I2C_NAME_SIZE);
> +	strscpy(board_info.type, "tf103c-dock-kbd");
>  	board_info.addr = TF103C_DOCK_KBD_ADDR;
>  	board_info.dev_name = TF103C_DOCK_DEV_NAME "-kbd";
>  
> @@ -846,8 +846,8 @@ static int tf103c_dock_probe(struct i2c_client *client)
>  	dock->hid->vendor = 0x0b05;  /* USB_VENDOR_ID_ASUSTEK */
>  	dock->hid->product = 0x0103; /* From TF-103-C */
>  	dock->hid->version = 0x0100; /* 1.0 */
> -	strscpy(dock->hid->name, "Asus TF103C Dock Keyboard", sizeof(dock->hid->name));
> -	strscpy(dock->hid->phys, dev_name(dev), sizeof(dock->hid->phys));
> +	strscpy(dock->hid->name, "Asus TF103C Dock Keyboard");
> +	strscpy(dock->hid->phys, dev_name(dev));
>  
>  	ret = hid_add_device(dock->hid);
>  	if (ret)
diff mbox series

Patch

diff --git a/drivers/platform/x86/asus-tf103c-dock.c b/drivers/platform/x86/asus-tf103c-dock.c
index 8f0f87637c5f..b441d8ca72d3 100644
--- a/drivers/platform/x86/asus-tf103c-dock.c
+++ b/drivers/platform/x86/asus-tf103c-dock.c
@@ -490,7 +490,7 @@  static void tf103c_dock_enable_touchpad(struct tf103c_dock_data *dock)
 		return;
 	}
 
-	strscpy(board_info.type, "elan_i2c", I2C_NAME_SIZE);
+	strscpy(board_info.type, "elan_i2c");
 	board_info.addr = TF103C_DOCK_TP_ADDR;
 	board_info.dev_name = TF103C_DOCK_DEV_NAME "-tp";
 	board_info.irq = dock->tp_irq;
@@ -795,7 +795,7 @@  static int tf103c_dock_probe(struct i2c_client *client)
 	 */
 	dock->ec_client = client;
 
-	strscpy(board_info.type, "tf103c-dock-intr", I2C_NAME_SIZE);
+	strscpy(board_info.type, "tf103c-dock-intr");
 	board_info.addr = TF103C_DOCK_INTR_ADDR;
 	board_info.dev_name = TF103C_DOCK_DEV_NAME "-intr";
 
@@ -803,7 +803,7 @@  static int tf103c_dock_probe(struct i2c_client *client)
 	if (IS_ERR(dock->intr_client))
 		return dev_err_probe(dev, PTR_ERR(dock->intr_client), "creating intr client\n");
 
-	strscpy(board_info.type, "tf103c-dock-kbd", I2C_NAME_SIZE);
+	strscpy(board_info.type, "tf103c-dock-kbd");
 	board_info.addr = TF103C_DOCK_KBD_ADDR;
 	board_info.dev_name = TF103C_DOCK_DEV_NAME "-kbd";
 
@@ -846,8 +846,8 @@  static int tf103c_dock_probe(struct i2c_client *client)
 	dock->hid->vendor = 0x0b05;  /* USB_VENDOR_ID_ASUSTEK */
 	dock->hid->product = 0x0103; /* From TF-103-C */
 	dock->hid->version = 0x0100; /* 1.0 */
-	strscpy(dock->hid->name, "Asus TF103C Dock Keyboard", sizeof(dock->hid->name));
-	strscpy(dock->hid->phys, dev_name(dev), sizeof(dock->hid->phys));
+	strscpy(dock->hid->name, "Asus TF103C Dock Keyboard");
+	strscpy(dock->hid->phys, dev_name(dev));
 
 	ret = hid_add_device(dock->hid);
 	if (ret)