From nobody Fri Feb 13 04:40:11 2026 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73ADD219F3 for ; Sun, 2 Jun 2024 09:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318974; cv=none; b=Uq39gtnMsg6CnSt3nkExvcked5/Hggz3nCgnrvpZM1tguk7VwDvtrvGJeKa1XTWRwPn/aXP8x+GNZIWItU7dm5+Wz3aP9w4e1HZcOBCUN9melsYNQDfJs4+8JFy86eaZ6IivHm9zYbEGcIu98Be9vdJ9pMOLp3UEE2XVKgxutLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318974; c=relaxed/simple; bh=ByJ2gn9CXxDqnzfeuHKTYoPy0ArsgzOsDRL+FAHDFKY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OEDfX7nZ7Rgmm3VRBlLJFNsyTs7RaXWNOGiGgQ4w1V1NUqoPoDi94m6ETjDl4R4bPC/+Mquup82ysiArNPxTJhzNFQpyQjiWxuGd5ElErXwkIg4O71gYxVZaA6PLMcRtBblXRstkz4dqIfUOQO+lt/75FoK2/POGWXaBxcbHxvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id e2b70418-20be-11ef-ab01-005056bdd08f; Sun, 02 Jun 2024 12:02:49 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 1/7] platform/x86: asus-tf103c-dock: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:54 +0300 Message-ID: <20240602090244.1666360-2-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Hans de Goede --- 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_d= ock_data *dock) return; } =20 - strscpy(board_info.type, "elan_i2c", I2C_NAME_SIZE); + strscpy(board_info.type, "elan_i2c"); board_info.addr =3D TF103C_DOCK_TP_ADDR; board_info.dev_name =3D TF103C_DOCK_DEV_NAME "-tp"; board_info.irq =3D dock->tp_irq; @@ -795,7 +795,7 @@ static int tf103c_dock_probe(struct i2c_client *client) */ dock->ec_client =3D client; =20 - strscpy(board_info.type, "tf103c-dock-intr", I2C_NAME_SIZE); + strscpy(board_info.type, "tf103c-dock-intr"); board_info.addr =3D TF103C_DOCK_INTR_ADDR; board_info.dev_name =3D TF103C_DOCK_DEV_NAME "-intr"; =20 @@ -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 cli= ent\n"); =20 - strscpy(board_info.type, "tf103c-dock-kbd", I2C_NAME_SIZE); + strscpy(board_info.type, "tf103c-dock-kbd"); board_info.addr =3D TF103C_DOCK_KBD_ADDR; board_info.dev_name =3D TF103C_DOCK_DEV_NAME "-kbd"; =20 @@ -846,8 +846,8 @@ static int tf103c_dock_probe(struct i2c_client *client) dock->hid->vendor =3D 0x0b05; /* USB_VENDOR_ID_ASUSTEK */ dock->hid->product =3D 0x0103; /* From TF-103-C */ dock->hid->version =3D 0x0100; /* 1.0 */ - strscpy(dock->hid->name, "Asus TF103C Dock Keyboard", sizeof(dock->hid->n= ame)); - 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)); =20 ret =3D hid_add_device(dock->hid); if (ret) --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A347D374D3 for ; Sun, 2 Jun 2024 09:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318977; cv=none; b=EfVA3egURlUTZZCBvMjZpOBelaz78TT6R6iOCYz6hUHbV27KTMnqNnKhkgv+gcICN/cySydnEriVtwqbLL1Af8DxPogRKFprVz1paCSEjUXYr8QUtx8AZA/FNmWfFdM/VNrix5KCn8hjbOj0zBYNrN1P7VA7jWbtDcybhlA3gQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318977; c=relaxed/simple; bh=9h94DqXvQDdb48Sdw6WpvBt3kLrGfO30x8RvJcq38WI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+1m0GclrMfe1vl0PjJDaZo4ib7Rk/IWtdqVtLL9MKtx821LkXkydZCYup7WZY17gidcZUZx8qtUoo9ifdzQWlTsi2K5MZsL0v/R8YI/ZJDHrkjUPwNsWCYicVf5rNMM5DKlXBsMhV7RuTJcE7H/Z9zcfOEkwQaM7k5j2i0KG+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id e39b5d9a-20be-11ef-8e3d-005056bdf889; Sun, 02 Jun 2024 12:02:50 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 2/7] platform/x86: hp: hp-bioscfg: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:55 +0300 Message-ID: <20240602090244.1666360-3-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- .../x86/hp/hp-bioscfg/enum-attributes.c | 18 +++++------------- .../x86/hp/hp-bioscfg/int-attributes.c | 7 ++----- .../x86/hp/hp-bioscfg/order-list-attributes.c | 18 +++++------------- .../x86/hp/hp-bioscfg/passwdobj-attributes.c | 19 +++++-------------- .../x86/hp/hp-bioscfg/spmobj-attributes.c | 3 +-- .../x86/hp/hp-bioscfg/string-attributes.c | 12 ++++-------- 6 files changed, 22 insertions(+), 55 deletions(-) diff --git a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c b/drivers= /platform/x86/hp/hp-bioscfg/enum-attributes.c index a2402d31c146..c50ad5880503 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/enum-attributes.c @@ -52,9 +52,7 @@ static void update_enumeration_value(int instance_id, cha= r *attr_value) { struct enumeration_data *enum_data =3D &bioscfg_drv.enumeration_data[inst= ance_id]; =20 - strscpy(enum_data->current_value, - attr_value, - sizeof(enum_data->current_value)); + strscpy(enum_data->current_value, attr_value); } =20 ATTRIBUTE_S_COMMON_PROPERTY_SHOW(display_name, enumeration); @@ -174,8 +172,7 @@ static int hp_populate_enumeration_elements_from_packag= e(union acpi_object *enum case VALUE: break; case PATH: - strscpy(enum_data->common.path, str_value, - sizeof(enum_data->common.path)); + strscpy(enum_data->common.path, str_value); break; case IS_READONLY: enum_data->common.is_readonly =3D int_value; @@ -222,9 +219,7 @@ static int hp_populate_enumeration_elements_from_packag= e(union acpi_object *enum if (ret) return -EINVAL; =20 - strscpy(enum_data->common.prerequisites[reqs], - str_value, - sizeof(enum_data->common.prerequisites[reqs])); + strscpy(enum_data->common.prerequisites[reqs], str_value); =20 kfree(str_value); str_value =3D NULL; @@ -236,8 +231,7 @@ static int hp_populate_enumeration_elements_from_packag= e(union acpi_object *enum break; =20 case ENUM_CURRENT_VALUE: - strscpy(enum_data->current_value, - str_value, sizeof(enum_data->current_value)); + strscpy(enum_data->current_value, str_value); break; case ENUM_SIZE: if (int_value > MAX_VALUES_SIZE) { @@ -278,9 +272,7 @@ static int hp_populate_enumeration_elements_from_packag= e(union acpi_object *enum * is greater than MAX_VALUES_SIZE */ if (size < MAX_VALUES_SIZE) - strscpy(enum_data->possible_values[pos_values], - str_value, - sizeof(enum_data->possible_values[pos_values])); + strscpy(enum_data->possible_values[pos_values], str_value); =20 kfree(str_value); str_value =3D NULL; diff --git a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c b/drivers/= platform/x86/hp/hp-bioscfg/int-attributes.c index 86b7ac63fec2..6c7f4d5fa9cb 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/int-attributes.c @@ -192,8 +192,7 @@ static int hp_populate_integer_elements_from_package(un= ion acpi_object *integer_ integer_data->current_value =3D int_value; break; case PATH: - strscpy(integer_data->common.path, str_value, - sizeof(integer_data->common.path)); + strscpy(integer_data->common.path, str_value); break; case IS_READONLY: integer_data->common.is_readonly =3D int_value; @@ -240,9 +239,7 @@ static int hp_populate_integer_elements_from_package(un= ion acpi_object *integer_ if (ret) continue; =20 - strscpy(integer_data->common.prerequisites[reqs], - str_value, - sizeof(integer_data->common.prerequisites[reqs])); + strscpy(integer_data->common.prerequisites[reqs], str_value); kfree(str_value); str_value =3D NULL; } diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/d= rivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c index 1ff09dfb7d7e..c6e57bb9d8b7 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c @@ -57,9 +57,7 @@ static void update_ordered_list_value(int instance, char = *attr_value) { struct ordered_list_data *ordered_list_data =3D &bioscfg_drv.ordered_list= _data[instance]; =20 - strscpy(ordered_list_data->current_value, - attr_value, - sizeof(ordered_list_data->current_value)); + strscpy(ordered_list_data->current_value, attr_value); } =20 ATTRIBUTE_S_COMMON_PROPERTY_SHOW(display_name, ordered_list); @@ -179,13 +177,11 @@ static int hp_populate_ordered_list_elements_from_pac= kage(union acpi_object *ord /* Assign appropriate element value to corresponding field*/ switch (eloc) { case VALUE: - strscpy(ordered_list_data->current_value, - str_value, sizeof(ordered_list_data->current_value)); + strscpy(ordered_list_data->current_value, str_value); replace_char_str(ordered_list_data->current_value, COMMA_SEP, SEMICOLON= _SEP); break; case PATH: - strscpy(ordered_list_data->common.path, str_value, - sizeof(ordered_list_data->common.path)); + strscpy(ordered_list_data->common.path, str_value); break; case IS_READONLY: ordered_list_data->common.is_readonly =3D int_value; @@ -227,9 +223,7 @@ static int hp_populate_ordered_list_elements_from_packa= ge(union acpi_object *ord if (ret) continue; =20 - strscpy(ordered_list_data->common.prerequisites[reqs], - str_value, - sizeof(ordered_list_data->common.prerequisites[reqs])); + strscpy(ordered_list_data->common.prerequisites[reqs], str_value); =20 kfree(str_value); str_value =3D NULL; @@ -271,9 +265,7 @@ static int hp_populate_ordered_list_elements_from_packa= ge(union acpi_object *ord part =3D strsep(&part_tmp, COMMA_SEP); =20 for (olist_elem =3D 0; olist_elem < MAX_ELEMENTS_SIZE && part; olist_el= em++) { - strscpy(ordered_list_data->elements[olist_elem], - part, - sizeof(ordered_list_data->elements[olist_elem])); + strscpy(ordered_list_data->elements[olist_elem], part); part =3D strsep(&part_tmp, COMMA_SEP); } ordered_list_data->elements_size =3D olist_elem; diff --git a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c b/dr= ivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c index f7efe217a4bb..35936c05e45b 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/passwdobj-attributes.c @@ -101,13 +101,9 @@ static int store_password_instance(struct kobject *kob= j, const char *buf, =20 if (!ret) { if (is_current) - strscpy(bioscfg_drv.password_data[id].current_password, - buf_cp, - sizeof(bioscfg_drv.password_data[id].current_password)); + strscpy(bioscfg_drv.password_data[id].current_password, buf_cp); else - strscpy(bioscfg_drv.password_data[id].new_password, - buf_cp, - sizeof(bioscfg_drv.password_data[id].new_password)); + strscpy(bioscfg_drv.password_data[id].new_password, buf_cp); } =20 kfree(buf_cp); @@ -272,8 +268,7 @@ static int hp_populate_password_elements_from_package(u= nion acpi_object *passwor case VALUE: break; case PATH: - strscpy(password_data->common.path, str_value, - sizeof(password_data->common.path)); + strscpy(password_data->common.path, str_value); break; case IS_READONLY: password_data->common.is_readonly =3D int_value; @@ -315,9 +310,7 @@ static int hp_populate_password_elements_from_package(u= nion acpi_object *passwor if (ret) break; =20 - strscpy(password_data->common.prerequisites[reqs], - str_value, - sizeof(password_data->common.prerequisites[reqs])); + strscpy(password_data->common.prerequisites[reqs], str_value); =20 kfree(str_value); str_value =3D NULL; @@ -359,9 +352,7 @@ static int hp_populate_password_elements_from_package(u= nion acpi_object *passwor if (ret) break; =20 - strscpy(password_data->encodings[pos_values], - str_value, - sizeof(password_data->encodings[pos_values])); + strscpy(password_data->encodings[pos_values], str_value); kfree(str_value); str_value =3D NULL; =20 diff --git a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c b/drive= rs/platform/x86/hp/hp-bioscfg/spmobj-attributes.c index 86f90238750c..2b00a14792e9 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/spmobj-attributes.c @@ -365,8 +365,7 @@ int hp_populate_secure_platform_data(struct kobject *at= tr_name_kobj) /* Populate data for Secure Platform Management */ bioscfg_drv.spm_data.attr_name_kobj =3D attr_name_kobj; =20 - strscpy(bioscfg_drv.spm_data.attribute_name, SPM_STR, - sizeof(bioscfg_drv.spm_data.attribute_name)); + strscpy(bioscfg_drv.spm_data.attribute_name, SPM_STR); =20 bioscfg_drv.spm_data.is_enabled =3D 0; bioscfg_drv.spm_data.mechanism =3D 0; diff --git a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c b/drive= rs/platform/x86/hp/hp-bioscfg/string-attributes.c index f0c20070094d..27758b779b2d 100644 --- a/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c +++ b/drivers/platform/x86/hp/hp-bioscfg/string-attributes.c @@ -50,7 +50,7 @@ static void update_string_value(int instance_id, char *at= tr_value) struct string_data *string_data =3D &bioscfg_drv.string_data[instance_id]; =20 /* Write settings to BIOS */ - strscpy(string_data->current_value, attr_value, sizeof(string_data->curre= nt_value)); + strscpy(string_data->current_value, attr_value); } =20 /* @@ -178,12 +178,10 @@ static int hp_populate_string_elements_from_package(u= nion acpi_object *string_ob /* Assign appropriate element value to corresponding field*/ switch (eloc) { case VALUE: - strscpy(string_data->current_value, - str_value, sizeof(string_data->current_value)); + strscpy(string_data->current_value, str_value); break; case PATH: - strscpy(string_data->common.path, str_value, - sizeof(string_data->common.path)); + strscpy(string_data->common.path, str_value); break; case IS_READONLY: string_data->common.is_readonly =3D int_value; @@ -231,9 +229,7 @@ static int hp_populate_string_elements_from_package(uni= on acpi_object *string_ob if (ret) continue; =20 - strscpy(string_data->common.prerequisites[reqs], - str_value, - sizeof(string_data->common.prerequisites[reqs])); + strscpy(string_data->common.prerequisites[reqs], str_value); kfree(str_value); str_value =3D NULL; } --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47D1B29CEC for ; Sun, 2 Jun 2024 09:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318975; cv=none; b=mIZ9UK+TEXLUUyJgSMLAB6mwesh178iM0Bza6PnNDHphG5+J2oDQpPIt5ycYUVUpaW4X6CtZrEyqlCpP4j9vC0zLbDBBbVi2AIjRBAjxzBQxvXhr+/u0K2EuLrFMDsy4ImtmCy0lXnl5xistgFfK/NWXtBhTxYpZiMT/39axGJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318975; c=relaxed/simple; bh=bQeuWPwSxT8QFhzr6uwQL9dUBoJgcUfr5QAmP07v+1Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EKP10oDuG/gyS+XoHcaftqG2xmjKYk2Rfw4uMQz9UpdQ8a5kKlZRicXEzNSOdt49gCLkM8yojuK0xOep5UzObEd1EFBGh9dBCX9n8EwHDZpp/Q0vkvdSOzp5RCX4UIEgPRxjsyq9uoKK8ufN0sPZMTeO+NkvESGTFocr1KVMaDI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id e40e5ddf-20be-11ef-8d47-005056bd6ce9; Sun, 02 Jun 2024 12:02:51 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 3/7] platform/x86: intel: chtwc_int33fe: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:56 +0300 Message-ID: <20240602090244.1666360-4-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/platform/x86/intel/chtwc_int33fe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/intel/chtwc_int33fe.c b/drivers/platform/= x86/intel/chtwc_int33fe.c index 93f75ba1dafd..11503b1c85f3 100644 --- a/drivers/platform/x86/intel/chtwc_int33fe.c +++ b/drivers/platform/x86/intel/chtwc_int33fe.c @@ -270,7 +270,7 @@ cht_int33fe_register_max17047(struct device *dev, struc= t cht_int33fe_data *data) } =20 memset(&board_info, 0, sizeof(board_info)); - strscpy(board_info.type, "max17047", I2C_NAME_SIZE); + strscpy(board_info.type, "max17047"); board_info.dev_name =3D "max17047"; board_info.fwnode =3D fwnode; data->battery_fg =3D i2c_acpi_new_device(dev, 1, &board_info); @@ -361,7 +361,7 @@ static int cht_int33fe_typec_probe(struct platform_devi= ce *pdev) } =20 memset(&board_info, 0, sizeof(board_info)); - strscpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE); + strscpy(board_info.type, "typec_fusb302"); board_info.dev_name =3D "fusb302"; board_info.fwnode =3D fwnode; board_info.irq =3D fusb302_irq; @@ -381,7 +381,7 @@ static int cht_int33fe_typec_probe(struct platform_devi= ce *pdev) memset(&board_info, 0, sizeof(board_info)); board_info.dev_name =3D "pi3usb30532"; board_info.fwnode =3D fwnode; - strscpy(board_info.type, "pi3usb30532", I2C_NAME_SIZE); + strscpy(board_info.type, "pi3usb30532"); =20 data->pi3usb30532 =3D i2c_acpi_new_device(dev, 3, &board_info); if (IS_ERR(data->pi3usb30532)) { --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw22-7.mail.saunalahti.fi (fgw22-7.mail.saunalahti.fi [62.142.5.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 548883D971 for ; Sun, 2 Jun 2024 09:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.83 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318983; cv=none; b=Ibv1jhseMY2VqMwuAzSGaIdv6lFWxilm3+/Z6qrgUvzJsmXXgTUu6Jipqk3aDh5pT1kLG9nHZ2JVPV5r2ltOhtPyn8YJHv+SHqgAHkwebgc2jSXHWx3n2H1JU3wDLcOUU3lXgWUee05GTBpW0z5CPTLTaQ944H5n1jy5ftkVerw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318983; c=relaxed/simple; bh=Zev7O1OaJPuWxSkFHl6udbLp67nkr4VjyCzglGcW7E0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lxr3N80Kn1wpDLhIBPTfhMmEDE1Ev/60/6xQAWNPr+O+FCMx2djeXGHmd0HE5No2lZpjL3KNRzOBUvg4wLqKsVSJLbaCOU3+5gz3EV+uRoozSu/d/COx1Vi3ybFlIF4CibQlutSpyMYMbqJc3hjkgpb9Z/Jx0P5jtnorLUiOrjE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id e4aa8b06-20be-11ef-ab01-005056bdd08f; Sun, 02 Jun 2024 12:02:52 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 4/7] platform/x86: serial-multi-instantiate: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:57 +0300 Message-ID: <20240602090244.1666360-5-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/platform/x86/serial-multi-instantiate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/plat= form/x86/serial-multi-instantiate.c index 97b9c6392230..3be016cfe601 100644 --- a/drivers/platform/x86/serial-multi-instantiate.c +++ b/drivers/platform/x86/serial-multi-instantiate.c @@ -131,7 +131,7 @@ static int smi_spi_probe(struct platform_device *pdev, = struct smi *smi, =20 ctlr =3D spi_dev->controller; =20 - strscpy(spi_dev->modalias, inst_array[i].type, sizeof(spi_dev->modalias)= ); + strscpy(spi_dev->modalias, inst_array[i].type); =20 ret =3D smi_get_irq(pdev, adev, &inst_array[i]); if (ret < 0) { @@ -205,7 +205,7 @@ static int smi_i2c_probe(struct platform_device *pdev, = struct smi *smi, =20 for (i =3D 0; i < count && inst_array[i].type; i++) { memset(&board_info, 0, sizeof(board_info)); - strscpy(board_info.type, inst_array[i].type, I2C_NAME_SIZE); + strscpy(board_info.type, inst_array[i].type); snprintf(name, sizeof(name), "%s-%s.%d", dev_name(dev), inst_array[i].ty= pe, i); board_info.dev_name =3D name; =20 --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F93B249E5 for ; Sun, 2 Jun 2024 09:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318976; cv=none; b=HHF5SkOzOFHa2+hnLNaIC2PtLM9UIUI5I6q7jKs7DtozK5zqQwwrXzJh1xb249HLS7jA5+DUY6xPfTpRYt33lCujQYQjWha2L1j3AEtUGxZUbBdM0ZE4itxxtX6MuVjvDEA60M6cr7qBJFHo2v+O4YpIRt4HAHCJImbTUSrAObQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318976; c=relaxed/simple; bh=A6dVcyj3TpXvLRLkS0fzqxH5DLBjNaIzUh/UVu5B6N0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZE4QKrzdKmJ7k1H3VBTWLKrhhjOlt3mHyoOnyAtt4NgrT1ooE3p83XULNgb1wNOikZX5KLrtf1RXAPALsdWwKuEMS5LCEUHwa5rCcDjZcXbwEH0kSEejjK7lMvkbVzVMYwhDWz9Gdfh/5uyGdfFrkkxxPKsXpNENekxO//M42sk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id e519696a-20be-11ef-8d47-005056bd6ce9; Sun, 02 Jun 2024 12:02:53 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 5/7] platform/x86: think-lmi: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:58 +0300 Message-ID: <20240602090244.1666360-6-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/platform/x86/think-lmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-= lmi.c index 0f2264bb7577..4cfb53206cb8 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1508,7 +1508,7 @@ static struct tlmi_pwd_setting *tlmi_create_auth(cons= t char *pwd_type, if (!new_pwd) return NULL; =20 - strscpy(new_pwd->kbdlang, "us", TLMI_LANG_MAXLEN); + strscpy(new_pwd->kbdlang, "us"); new_pwd->encoding =3D TLMI_ENCODING_ASCII; new_pwd->pwd_type =3D pwd_type; new_pwd->role =3D pwd_role; @@ -1582,7 +1582,7 @@ static int tlmi_analyze(void) goto fail_clear_attr; } setting->index =3D i; - strscpy(setting->display_name, item, TLMI_SETTINGS_MAXLEN); + strscpy(setting->display_name, item); /* If BIOS selections supported, load those */ if (tlmi_priv.can_get_bios_selections) { ret =3D tlmi_get_bios_selections(setting->display_name, --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6792381BE for ; Sun, 2 Jun 2024 09:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318978; cv=none; b=hFFJgzsad1xIDHfkI6j1Z6F57UizAprbcSC32/lJseIesSK33X0vnJjRVlgB5lC0l03A4lr5xnYQ0iY6XNeh1JK2OFPUD6VIn0Um2hkayfuArue34wbVhhjtM/J6gA5o0miQq5JgbNCTuLqag5oFuzKEshU39fHNrdTfD2XL1Z0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318978; c=relaxed/simple; bh=UgAuMHpFIkncb10bX6YzLxaitjoHyiUwEFu7OS+KpA4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fP63z0pIosjje7hX/tKHbc2DEjTEg0wrQUjshL/SQ+HyS6WrrS1x2Z2P/pEGfVjVjGG2fo+/C3GtrqAgfGMfAgSS0xPp9LX5qBCkwCGYuBk1YEbqvTXAgR1wjAM8xsavvBNP7r1+vc0j3jRgm8ob8YHj7oGrrSUXDAxHBkVOQnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw22.mail.saunalahti.fi (Halon) with ESMTP id e585c43e-20be-11ef-8e3d-005056bdf889; Sun, 02 Jun 2024 12:02:53 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 6/7] platform/x86: thinkpad_acpi: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:57:59 +0300 Message-ID: <20240602090244.1666360-7-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/platform/x86/thinkpad_acpi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_acpi.c index 397b409064c9..f269ca1ff771 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -7416,10 +7416,8 @@ static int __init volume_create_alsa_mixer(void) data =3D card->private_data; data->card =3D card; =20 - strscpy(card->driver, TPACPI_ALSA_DRVNAME, - sizeof(card->driver)); - strscpy(card->shortname, TPACPI_ALSA_SHRTNAME, - sizeof(card->shortname)); + strscpy(card->driver, TPACPI_ALSA_DRVNAME); + strscpy(card->shortname, TPACPI_ALSA_SHRTNAME); snprintf(card->mixername, sizeof(card->mixername), "ThinkPad EC %s", (thinkpad_id.ec_version_str) ? thinkpad_id.ec_version_str : "(unknown)"); --=20 2.45.1 From nobody Fri Feb 13 04:40:11 2026 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BE0D3F9F9 for ; Sun, 2 Jun 2024 09:03:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318985; cv=none; b=rmRl4bTCJuk70oNHN0HHoLISzaeRao+rjb1gC5H0j6OsPPoGtyZH+aaFBUnmUQehjwta3+CPLn62GdzA8QOfNtfe0sYQ5OaW+xgq5cwczK1OyiAxl1bqFL6HrK2QKmODPx5vhCjJqKALgbHRTwYilL68O/MKNX8vPI3mD3jx5M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717318985; c=relaxed/simple; bh=kjAyPZMiSO/QOUSk3fdxY5FJ/AeIhJLqhUfXYyQ05PA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m924ZsnGnY58cz7o8pUrmQn+xtTUlaiLY6s1nkURy1dGoYtoqVvITGJNMyGLYpAqlDJFEmiMnSaR0t0FaVy7DNhJD3+9OEfpEXGKVt+IikQmXox8qKo/+09D/3Ry37oxIGizvFdxpPBR0rW9K6WNVgNQH5ZGzy/yk8uQL5jKnEk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-230.elisa-laajakaista.fi [88.113.26.230]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id e5f4102e-20be-11ef-8d47-005056bd6ce9; Sun, 02 Jun 2024 12:02:54 +0300 (EEST) From: Andy Shevchenko To: Hans de Goede , Andy Shevchenko , Jorge Lopez , Li Zetao , Simon Trimmer , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Mark Pearson , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, linux-input@vger.kernel.org Cc: Corentin Chary , "Luke D. Jones" , Mark Pearson , Henrique de Moraes Holschuh Subject: [PATCH v1 7/7] platform/x86: touchscreen_dmi: Use 2-argument strscpy() Date: Sun, 2 Jun 2024 11:58:00 +0300 Message-ID: <20240602090244.1666360-8-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240602090244.1666360-1-andy.shevchenko@gmail.com> References: <20240602090244.1666360-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/platform/x86/touchscreen_dmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/= touchscreen_dmi.c index 2d9ca2292ea1..879a63e4ecd0 100644 --- a/drivers/platform/x86/touchscreen_dmi.c +++ b/drivers/platform/x86/touchscreen_dmi.c @@ -1907,7 +1907,7 @@ static int __init ts_parse_props(char *str) u32 u32val; int i, ret; =20 - strscpy(orig_str, str, sizeof(orig_str)); + strscpy(orig_str, str); =20 /* * str is part of the static_command_line from init/main.c and poking --=20 2.45.1