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: <CAFhGd8om4HrsSFKXYecpLxWoYc3WiVBO8jfKP-9x4ToiCYEU_g@mail.gmail.com>
Date: Wed, 27 Sep 2023 23:06:51 +0900
From: Justin Stitt <justinstitt@...gle.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3] hwmon: refactor deprecated strncpy

On Wed, Sep 27, 2023 at 11:05 PM Justin Stitt <justinstitt@...gle.com> wrote:
>
> On Wed, Sep 27, 2023 at 9:49 PM Guenter Roeck <linux@...ck-us.net> wrote:
> >
> > On Thu, Sep 21, 2023 at 05:41:46AM +0000, Justin Stitt wrote:
> > > `strncpy` is deprecated for use on NUL-terminated destination strings [1].
> > >
> > > Let's refactor this kcalloc() + strncpy() into a kmemdup_nul() which has
> > > more obvious behavior and is less error prone.
> > >
> > > To avoid truncating the last byte supply `...length + 1` to
> > > kmemdup_nul() as `element->string.length` does not account for the
> > > trailing null as made obvious from it's definition (and associated
> > > comment):
> > > |       u32 length;   /* # of bytes in string, excluding trailing null */
> > >
> > > ... this is precisely what the original kcalloc invocation did as well.
> > >
> > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> > > Link: https://github.com/KSPP/linux/issues/90
> > > Cc: linux-hardening@...r.kernel.org
> > > Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> >
> > I have multiple patches with the hwmon: prefix but no driver,
> > like this one, suggesting the change is in the hwmon core,
> > when in reality it is in some hwmon driver.
> > I am not going to apply any of those, and I am not even going to
> > look into them.
>
> Whoops, I was using some tooling to auto-fetch prefixes and the style
> of "xyz: (stuff in paren)" isn't always caught.
>
> I will resend with a fixed subject line matching the appropriate driver.

Erhm, In this case I seem to have caught the mistake over in [v5].
>
> >
> > Guenter
>
> Thanks
> Justin

[v5]: https://lore.kernel.org/all/20230926-strncpy-drivers-hwmon-acpi_power_meter-c-v5-1-3fc31a9daf99@google.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ