Re: [PATCH] md/md-multipath: Convert "struct mpconf" to flexible array

2023-12-11 Thread Song Liu
Hi Christoph, On Mon, Dec 11, 2023 at 9:46 PM Christoph Hellwig wrote: > > On Fri, Dec 08, 2023 at 10:11:10AM -0800, Song Liu wrote: > > We marked it as deprecated about 2.5 years ago. But to be honest, > > I currently don't have a plan to remove it. I guess I should start thinking > > about it.

Re: [PATCH v3] iio: sx9324: avoid copying property strings

2023-12-11 Thread Joe Perches
On Tue, 2023-12-12 at 00:42 +, Justin Stitt wrote: > We're doing some needless string copies when trying to assign the proper > `prop` string. We can make `prop` a const char* and simply assign to > string literals. trivia: I would have updated it like this moving the various declarations

Re: [PATCH] md/md-multipath: Convert "struct mpconf" to flexible array

2023-12-11 Thread Christoph Hellwig
On Fri, Dec 08, 2023 at 10:11:10AM -0800, Song Liu wrote: > We marked it as deprecated about 2.5 years ago. But to be honest, > I currently don't have a plan to remove it. I guess I should start thinking > about it. Let's just kill it off ASAP. It never had a large user base and based by

[PATCH v2] PCI: Prevent device from doing RPM when it's unplugged

2023-12-11 Thread Kai-Heng Feng
When inserting an SD7.0 card to Realtek card reader, the card reader unplugs itself and morph into a NVMe device. The slot Link down on hot unplugged can cause the following error: [ 63.898861] pcieport :00:1c.0: pciehp: Slot(8): Link Down [ 63.912118] BUG: unable to handle page fault for

[PATCH v2] scsi: ibmvscsi_tgt: replace deprecated strncpy with strscpy

2023-12-11 Thread Justin Stitt
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. We don't need the NUL-padding behavior that strncpy() provides as vscsi is NUL-allocated in ibmvscsis_probe() which proceeds to call

Re: [PATCH v2] iio: sx9324: avoid copying property strings

2023-12-11 Thread Justin Stitt
Hi, On Mon, Oct 30, 2023 at 2:44 PM Stephen Boyd wrote: > > > We need to free it in other places too, like if the count doesn't match. > It may be easier to extract this section and just have 4 string > literals. > > switch (reg_def->reg) { > case SX9324_REG_AFE_PH0: >

[PATCH v3] iio: sx9324: avoid copying property strings

2023-12-11 Thread Justin Stitt
We're doing some needless string copies when trying to assign the proper `prop` string. We can make `prop` a const char* and simply assign to string literals. For the case where a format string is used, let's extract the parsing logic out into sx9324_parse_phase_prop(). We no longer need to

Re: [PATCH v3] net: mdio-gpio: replace deprecated strncpy with strscpy

2023-12-11 Thread Russell King (Oracle)
On Mon, Dec 11, 2023 at 07:10:00PM +, Justin Stitt wrote: > strncpy() is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect new_bus->id to be NUL-terminated but not NUL-padded based on >

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-11 Thread Andy Shevchenko
On Mon, Dec 11, 2023 at 10:48 PM Nick Desaulniers wrote: > On Tue, Dec 5, 2023 at 1:44 PM Al Viro wrote: > > On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > > > > > The tooling Tanzir is working on does wrap IWYU, and does support such > > > mapping (of 'low level' to 'high

Re: [PATCH] lib/string: shrink lib/string.i via IWYU

2023-12-11 Thread Nick Desaulniers
On Tue, Dec 5, 2023 at 1:44 PM Al Viro wrote: > > On Tue, Dec 05, 2023 at 01:39:47PM -0800, Nick Desaulniers wrote: > > > The tooling Tanzir is working on does wrap IWYU, and does support such > > mapping (of 'low level' to 'high level' headers; more so, if it > > recommends X you can override to

Re: [PATCH] scsi: fcoe: replace deprecated strncpy with strscpy

2023-12-11 Thread Bart Van Assche
On 12/11/23 12:08, Justin Stitt wrote: Hi, On Tue, Oct 24, 2023 at 1:01 PM Bart Van Assche wrote: On 10/24/23 12:52, Justin Stitt wrote: diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c index e17957f8085c..7a3ca6cd3030 100644 --- a/drivers/scsi/fcoe/fcoe_sysfs.c

Re: [PATCH] scsi: fcoe: replace deprecated strncpy with strscpy

2023-12-11 Thread Justin Stitt
ider to remove the code for copying the sysfs string and to > use sysfs_match_string() instead. > Sorry, I'm not too familiar with sysfs strings here. Let me know what you think of this patch [1]. > Thanks, > > Bart. > [1]: https://lore.kernel.org/r/20231211-strncpy-drivers-scsi-fcoe-fcoe_sysfs-c-v1-1-73b942238...@google.com Thanks Justin

[PATCH] scsi: fcoe: use sysfs_match_string over fcoe_parse_mode

2023-12-11 Thread Justin Stitt
Instead of copying @buf into a new buffer and carefully managing its newline/null-terminating status, we can just use sysfs_match_string() as it uses sysfs_streq() internally which handles newline/null-term: | /** | * sysfs_streq - return true if strings are equal, modulo trailing newline |

Re: [PATCH v2] net: mdio-gpio: replace deprecated strncpy with strscpy

2023-12-11 Thread Justin Stitt
t using MII_BUS_ID_SIZE in one place, > then the very same argument applies to snprintf(). If one place > changes the other also needs to be changed. > Gotcha, I've sent a [v3]. > -- > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! [v3]: https://lore.kernel.org/all/20231211-strncpy-drivers-net-mdio-mdio-gpio-c-v3-1-76dea53a1...@google.com/ Thanks Justin

[PATCH v3] net: mdio-gpio: replace deprecated strncpy with strscpy

2023-12-11 Thread Justin Stitt
strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. We expect new_bus->id to be NUL-terminated but not NUL-padded based on its prior assignment through snprintf: | snprintf(new_bus->id,

Re: [PATCH v2 00/18] sysctl: constify sysctl ctl_tables

2023-12-11 Thread Thomas Weißschuh
On 2023-12-08 10:59:26+0100, Joel Granados wrote: > On Thu, Dec 07, 2023 at 08:19:43PM +0100, Thomas Weißschuh wrote: > > On 2023-12-07 11:43:57+0100, Joel Granados wrote: > [..] > > > I suggest you chunk it up with directories in mind. Something similar to > > > what I did for [4] where I

RE: [PATCH v3] netlink: Return unsigned value for nla_len()

2023-12-11 Thread David Laight
From: Kees Cook > Sent: 06 December 2023 20:59 > > The return value from nla_len() is never expected to be negative, and can > never be more than struct nlattr::nla_len (a u16). Adjust the prototype > on the function. This will let GCC's value range optimization passes > know that the return can

Re: [PATCH v2 00/18] sysctl: constify sysctl ctl_tables

2023-12-11 Thread Joel Granados
On Thu, Dec 07, 2023 at 08:19:43PM +0100, Thomas Weißschuh wrote: > On 2023-12-07 11:43:57+0100, Joel Granados wrote: > > Hey Thomas > > > > You have a couple of test bot issues for your 12/18 patch. Can you > > please address those for your next version. > > I have these fixed locally, I