mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Abdul Rahim <abdul.rahim@myyahoo.com>,
	corentin.chary@gmail.com, luke@ljones.dev,
	ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] asus-laptop: prefer strscpy() over strcpy()
Date: Thu, 10 Oct 2024 11:40:44 +0200	[thread overview]
Message-ID: <d49c5a2d-3715-447f-9936-fadba12bb225@redhat.com> (raw)
In-Reply-To: <20241009230558.51892-1-abdul.rahim@myyahoo.com>

Hi,

On 10-Oct-24 1:05 AM, Abdul Rahim wrote:
> The function strcpy() is depreciated and potentially unsafe. It 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. The safe replacement is strscpy() [1].
> 
> this fixes checkpatch warning:
>     WARNING: Prefer strscpy over strcpy
> 
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> Signed-off-by: Abdul Rahim <abdul.rahim@myyahoo.com>

Thanks, patch looks good to me:

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

Regards,

Hans



> ---
>  drivers/platform/x86/asus-laptop.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
> index 9d7e6b712abf..d460dd194f19 100644
> --- a/drivers/platform/x86/asus-laptop.c
> +++ b/drivers/platform/x86/asus-laptop.c
> @@ -1832,8 +1832,8 @@ static int asus_acpi_add(struct acpi_device *device)
>  	if (!asus)
>  		return -ENOMEM;
>  	asus->handle = device->handle;
> -	strcpy(acpi_device_name(device), ASUS_LAPTOP_DEVICE_NAME);
> -	strcpy(acpi_device_class(device), ASUS_LAPTOP_CLASS);
> +	strscpy(acpi_device_name(device), ASUS_LAPTOP_DEVICE_NAME);
> +	strscpy(acpi_device_class(device), ASUS_LAPTOP_CLASS);
>  	device->driver_data = asus;
>  	asus->device = device;
>  


  parent reply	other threads:[~2024-10-10  9:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241009230558.51892-1-abdul.rahim.ref@myyahoo.com>
2024-10-09 23:05 ` Abdul Rahim
2024-10-09 23:10   ` Luke Jones
2024-10-10  9:40   ` Hans de Goede [this message]
2024-10-10 12:25   ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d49c5a2d-3715-447f-9936-fadba12bb225@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=abdul.rahim@myyahoo.com \
    --cc=corentin.chary@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luke@ljones.dev \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®