* [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy
@ 2025-01-07 2:15 Nitin Joshi
2025-01-07 15:13 ` Mark Pearson
2025-01-07 18:36 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Nitin Joshi @ 2025-01-07 2:15 UTC (permalink / raw)
To: Ilpo Järvinen, Hans de Goede
Cc: Mark Pearson, platform-driver-x86, linux-kernel, Nitin Joshi
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors.[1]
[1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Nitin Joshi <nitjoshi@gmail.com>
---
drivers/platform/x86/thinkpad_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 2cfb2ac3f465..c9e2dfb942ec 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -11681,7 +11681,7 @@ static int __init set_ibm_param(const char *val, const struct kernel_param *kp)
if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
if (strlen(val) > sizeof(ibms_init[i].param) - 1)
return -ENOSPC;
- strcpy(ibms_init[i].param, val);
+ strscpy(ibms_init[i].param, val);
return 0;
}
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy
2025-01-07 2:15 [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy Nitin Joshi
@ 2025-01-07 15:13 ` Mark Pearson
2025-01-07 18:36 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Mark Pearson @ 2025-01-07 15:13 UTC (permalink / raw)
To: Nitin Joshi, Ilpo Järvinen, Hans de Goede
Cc: platform-driver-x86@vger.kernel.org, linux-kernel
Hi Nitin,
On Mon, Jan 6, 2025, at 9:15 PM, Nitin Joshi wrote:
> strcpy() performs no bounds checking on the destination buffer. This
> could result in linear overflows beyond the end of the buffer, leading
> to all kinds of misbehaviors.[1]
>
> [1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
>
> Signed-off-by: Nitin Joshi <nitjoshi@gmail.com>
> ---
> drivers/platform/x86/thinkpad_acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/thinkpad_acpi.c
> b/drivers/platform/x86/thinkpad_acpi.c
> index 2cfb2ac3f465..c9e2dfb942ec 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -11681,7 +11681,7 @@ static int __init set_ibm_param(const char
> *val, const struct kernel_param *kp)
> if (strcmp(ibm->name, kp->name) == 0 && ibm->write) {
> if (strlen(val) > sizeof(ibms_init[i].param) - 1)
> return -ENOSPC;
> - strcpy(ibms_init[i].param, val);
> + strscpy(ibms_init[i].param, val);
> return 0;
> }
> }
> --
> 2.43.0
Looks good to me.
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy
2025-01-07 2:15 [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy Nitin Joshi
2025-01-07 15:13 ` Mark Pearson
@ 2025-01-07 18:36 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2025-01-07 18:36 UTC (permalink / raw)
To: Hans de Goede, Nitin Joshi
Cc: Mark Pearson, platform-driver-x86, linux-kernel
On Tue, 07 Jan 2025 11:15:07 +0900, Nitin Joshi wrote:
> strcpy() performs no bounds checking on the destination buffer. This
> could result in linear overflows beyond the end of the buffer, leading
> to all kinds of misbehaviors.[1]
>
> [1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
>
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: thinkpad-acpi: replace strcpy with strscpy
commit: c9a90d746c09e61b1acb829d93f8283e296563fd
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-07 18:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 2:15 [PATCH] platform/x86: thinkpad-acpi: replace strcpy with strscpy Nitin Joshi
2025-01-07 15:13 ` Mark Pearson
2025-01-07 18:36 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox