lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABKbRoL4_rDZeTToaZn+Pug47pGB31ErvPR3C3uaspgnd=3Zww@mail.gmail.com>
Date: Tue, 29 Jul 2025 09:38:04 +0200
From: Miguel García Román <miguelgarciaroman8@...il.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org, 
	yu.c.chen@...el.com, hansg@...nel.org, ilpo.jarvinen@...ux.intel.com, 
	luzmaximilian@...il.com, skhan@...uxfoundation.org
Subject: Re: [PATCH] platform/x86: surfacepro3_button: replace deprecated
 strcpy() with strscpy()

Hi all,

thanks for the review. You were right about sizeof(name) being the pointer size.
I’ve sent v3 bounding with MAX_ACPI_DEVICE_NAME_LEN. Compile-tested only (x86_64
defconfig/allmodconfig, W=1); no Surface hardware. Apologies for the noise.

Best regards,

El lun, 28 jul 2025 a las 7:30, Krzysztof Kozlowski
(<krzk@...nel.org>) escribió:
>
> On 24/07/2025 09:45, Miguel García wrote:
> > strcpy() is deprecated for NUL-terminated strings. Replace it with
> > strscpy() to guarantee NUL-termination. 'name' is a fixed-size local
> > buffer.
> >
> > Signed-off-by: Miguel García <miguelgarciaroman8@...il.com>
> > ---
> >  drivers/platform/surface/surfacepro3_button.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/surface/surfacepro3_button.c b/drivers/platform/surface/surfacepro3_button.c
> > index 2755601f979c..9616548283a1 100644
> > --- a/drivers/platform/surface/surfacepro3_button.c
> > +++ b/drivers/platform/surface/surfacepro3_button.c
> > @@ -211,7 +211,7 @@ static int surface_button_add(struct acpi_device *device)
> >       }
> >
> >       name = acpi_device_name(device);
> > -     strcpy(name, SURFACE_BUTTON_DEVICE_NAME);
> > +     strscpy(name, SURFACE_BUTTON_DEVICE_NAME, sizeof(name));
>
>
> Why are you copying four/eight characters if the string is around 16?
>
> How did you test it (and I doubt you did since you change multiple
> different files from different architectures)?
>
>
> Best regards,
> Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ