Re: [PATCH 03/19] fs: release anon dev_t in deactivate_locked_super

2023-10-10 Thread Christian Brauner
> list removal should happen after generic_shutdown_super(). Sure, you > want the superblock to serve as bdev holder, which leads to fun > with -EBUSY if mount comes while umount still hadn't closed the > device. I suspect that it would make a lot more sense to > introduce an intermediate state -

Re: [PATCH] net: dsa: mt7530: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread AngeloGioacchino Del Regno
Il 09/10/23 20:29, Justin Stitt ha scritto: `strncpy` is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. ethtool_sprintf() is designed specifically for get_strings() usage. Let's replace strncpy in favor

Re: [PATCH] net: dsa: realtek: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Linus Walleij
On Tue, Oct 10, 2023 at 12:47 AM 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. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let's repl

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Alvin Šipraga
On Mon, Oct 09, 2023 at 10:43:59PM +, Justin Stitt wrote: > [You don't often get email from justinst...@google.com. Learn why this is > important at https://aka.ms/LearnAboutSenderIdentification ] > > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we s

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
Hello Justin, On Mon, Oct 09, 2023 at 10:43:59PM +, 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. > > ethtool_sprintf() is designed specifically for get_strings

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Mon, Oct 09, 2023 at 10:54:37PM +, 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. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let

Re: [PATCH][next] hostap: Add __counted_by for struct prism2_download_data and use struct_size()

2023-10-10 Thread Gustavo A. R. Silva
On 10/10/23 08:17, Kalle Valo wrote: No need to resend. I marked Kees' version as Superseded so that I don't accidentally take the wrong version. In the title "wifi:" is missing but I can add that during commit. Awesome. :) Thanks, Kalle! -- Gustavo

[PATCH][next] atags_proc: Add __counted_by for struct buffer and use struct_size()

2023-10-10 Thread Gustavo A. R. Silva
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). W

[PATCH][next] afs: Add __counted_by for struct afs_acl and use struct_size()

2023-10-10 Thread Gustavo A. R. Silva
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions). W

Re: [PATCH][next] iommu/virtio: Add __counted_by for struct viommu_request and use struct_size()

2023-10-10 Thread Jean-Philippe Brucker
On Mon, Oct 09, 2023 at 12:24:27PM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array

Re: [PATCH][next] wifi: brcmfmac: fweh: Add __counted_by for struct brcmf_fweh_queue_item and use struct_size()

2023-10-10 Thread Arend Van Spriel
On October 9, 2023 11:42:11 PM "Gustavo A. R. Silva" wrote: Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) a

[PATCH v6 0/9] Initial Marvell PXA1908 support

2023-10-10 Thread Duje Mihanović
Hello, This series adds initial support for the Marvell PXA1908 SoC and "samsung,coreprimevelte", a smartphone using the SoC. USB works and the phone can boot a rootfs from an SD card, but there are some warnings in the dmesg: During SMP initialization: [0.006519] CPU features: SANITY CHECK:

[PATCH v6 2/9] dt-bindings: pinctrl: pinctrl-single: add marvell,pxa1908-padconf compatible

2023-10-10 Thread Duje Mihanović
Add the "marvell,pxa1908-padconf" compatible to allow migrating to a separate pinctrl driver later. Signed-off-by: Duje Mihanović --- Documentation/devicetree/bindings/pinctrl/pinctrl-single.yaml | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/pinctrl/pi

[PATCH v6 3/9] pinctrl: single: add marvell,pxa1908-padconf compatible

2023-10-10 Thread Duje Mihanović
Add the "marvell,pxa1908-padconf" compatible to allow migrating to a separate pinctrl driver later. Signed-off-by: Duje Mihanović --- drivers/pinctrl/pinctrl-single.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 461

[PATCH v6 5/9] clk: mmp: Add Marvell PXA1908 clock driver

2023-10-10 Thread Duje Mihanović
Add driver for Marvell PXA1908 clock controller blocks. The SoC has numerous clock controller blocks, currently supporting APBC, APBCP, MPMU and APMU. Signed-off-by: Duje Mihanović --- drivers/clk/mmp/Makefile | 2 +- drivers/clk/mmp/clk-of-pxa1908.c | 328 +

[PATCH v6 1/9] clk: mmp: Switch to use struct u32_fract instead of custom one

2023-10-10 Thread Duje Mihanović
From: Andy Shevchenko The struct mmp_clk_factor_tbl repeats the generic struct u32_fract. Kill the custom one and use the generic one instead. Signed-off-by: Andy Shevchenko Tested-by: Duje Mihanović Reviewed-by: Linus Walleij Signed-off-by: Duje Mihanović --- drivers/clk/mmp/clk-frac.c

[PATCH v6 4/9] dt-bindings: clock: Add Marvell PXA1908 clock bindings

2023-10-10 Thread Duje Mihanović
Add dt bindings and documentation for the Marvell PXA1908 clock controller. Reviewed-by: Conor Dooley Signed-off-by: Duje Mihanović --- .../devicetree/bindings/clock/marvell,pxa1908.yaml | 48 include/dt-bindings/clock/marvell,pxa1908.h| 88 ++ 2 files c

[PATCH v6 6/9] dt-bindings: marvell: Document PXA1908 SoC

2023-10-10 Thread Duje Mihanović
Add dt binding for the Marvell PXA1908 SoC. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Duje Mihanović --- Documentation/devicetree/bindings/arm/mrvl/mrvl.yaml | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/mrvl/mrvl.yaml b/Documentation/devi

[PATCH v6 7/9] arm64: Kconfig.platforms: Add config for Marvell PXA1908 platform

2023-10-10 Thread Duje Mihanović
Add ARCH_MMP configuration option for Marvell PXA1908 SoC. Signed-off-by: Duje Mihanović --- arch/arm64/Kconfig.platforms | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 6069120199bb..b417cae42c84 100644 --- a/arc

[PATCH v6 9/9] MAINTAINERS: add myself as Marvell PXA1908 maintainer

2023-10-10 Thread Duje Mihanović
Add myself as the maintainer for Marvell PXA1908 SoC support. Signed-off-by: Duje Mihanović --- MAINTAINERS | 9 + 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6c4cce45a09d..38c99e687976 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2312,6 +2312,15 @@ F:

[PATCH v6 8/9] arm64: dts: Add DTS for Marvell PXA1908 and samsung,coreprimevelte

2023-10-10 Thread Duje Mihanović
Add DTS for Marvell PXA1908 SoC and Samsung Galaxy Core Prime Value Edition LTE, a smartphone based on said SoC. Signed-off-by: Duje Mihanović --- arch/arm64/boot/dts/marvell/Makefile | 3 + .../dts/marvell/pxa1908-samsung-coreprimevelte.dts | 333 + arch/arm6

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 4:07 AM Vladimir Oltean wrote: > > Hello Justin, > > On Mon, Oct 09, 2023 at 10:43:59PM +, 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 > > interf

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 4:20 AM Vladimir Oltean wrote: > > On Mon, Oct 09, 2023 at 10:54:37PM +, 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. > > > > etht

Re: [PATCH][next] atags_proc: Add __counted_by for struct buffer and use struct_size()

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 5:47 AM Gustavo A. R. Silva wrote: > > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array indexi

[PATCH] e1000: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
_name(pdev), sizeof(netdev->name) - 1); + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); adapter->bd_number = cards_found; --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231010-strncpy-drivers-net-ethernet-intel-e1000-e1000_main-c-a45ddd89e0d7 Best regards, -- Justin Stitt

[PATCH] fm10k: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
atic void fm10k_get_pauseparam(struct net_device *dev, --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231010-strncpy-drivers-net-ethernet-intel-fm10k-fm10k_ethtool-c-8184ea77861f Best regards, -- Justin Stitt

[PATCH] i40e: use scnprintf over strncpy+strncat

2023-10-10 Thread Justin Stitt
: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231010-strncpy-drivers-net-ethernet-intel-i40e-i40e_ddp-c-dd7f20b7ed5d Best regards, -- Justin Stitt

[PATCH] igb: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
, pci_name(pdev), sizeof(netdev->name) - 1); + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); netdev->mem_start = pci_resource_start(pdev, 0); netdev->mem_end = pci_resource_end(pdev, 0); --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49

[PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
e, pci_name(pdev), sizeof(netdev->name) - 1); + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); adapter->bd_number = cards_found++; --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231010-strncpy-drivers-net-ethernet-intel-igbvf-netdev-c-aea454a18a2d Best regards, -- Justin Stitt

[PATCH] igc: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
*/ igc_get_hw_control(adapter); - strncpy(netdev->name, "eth%d", IFNAMSIZ); + strscpy(netdev->name, "eth%d", sizeof(netdev->name)); err = register_netdev(netdev); if (err) goto err_register; --- base-commit: c

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Jesse Brandeburg
On 10/10/2023 2:12 PM, 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 netdev->name to be NUL-terminated based on its usage with > `strlen` and format st

Re: [PATCH] i40e: use scnprintf over strncpy+strncat

2023-10-10 Thread Jesse Brandeburg
On 10/10/2023 1:53 PM, 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. > > Moreover, `strncat` shouldn't really be used either as per > fortify-string.h: > * Do not u

Re: [PATCH] igb: replace deprecated strncpy with strscpy

2023-10-10 Thread Jesse Brandeburg
On 10/10/2023 2:07 PM, 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 see that netdev->name is expected to be NUL-terminated based on its > usage with format s

Re: [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-10 Thread Jesse Brandeburg
On 10/10/2023 2:15 PM, 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 netdev->name to be NUL-terminated based on its use with format > strings: > |

[PATCH] net: mvpp2: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
); } if (port_node) --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231010-strncpy-drivers-net-ethernet-marvell-mvpp2-mvpp2_main-c-e9743cf1cf8f Best regards, -- Justin Stitt

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Jesse Brandeburg
On 10/10/2023 2:20 PM, Jesse Brandeburg wrote: > On 10/10/2023 2:12 PM, 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 netdev->name to be NUL-termin

[PATCH] octeontx2-af: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
lmac_string = cgx_lmactype_string[linfo->lmac_type_id]; - strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1); + strscpy(linfo->lmac_type, cgx_lmactype_string[linfo->lmac_type_id], + sizeof(linfo->lmac_type)); } /* Hardware event handlers */

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 2:20 PM Jesse Brandeburg wrote: > > On 10/10/2023 2:12 PM, 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 netdev->name

Re: [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 2:22 PM Jesse Brandeburg wrote: > > On 10/10/2023 2:15 PM, 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 netdev->name

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 10:36 AM Justin Stitt wrote: > > On Tue, Oct 10, 2023 at 4:07 AM Vladimir Oltean wrote: > > > > Hello Justin, > > > > On Mon, Oct 09, 2023 at 10:43:59PM +, Justin Stitt wrote: > > > `strncpy` is deprecated for use on NUL-terminated destination strings > > > [1] and as

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Justin Stitt
On Tue, Oct 10, 2023 at 4:20 AM Vladimir Oltean wrote: > > On Mon, Oct 09, 2023 at 10:54:37PM +, 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. > > > > etht

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 02:48:07PM -0700, Justin Stitt wrote: > On Tue, Oct 10, 2023 at 10:36 AM Justin Stitt wrote: > > > Is there any particular reason why you opted for the "%s" printf format > > > specifier when you could have simply given mib->name as the single > > > argument? This comment a

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Mon, Oct 09, 2023 at 10:43:59PM +, 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. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let

Re: [PATCH] net: dsa: realtek: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Mon, Oct 09, 2023 at 10:47:37PM +, 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. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 02:49:26PM -0700, Justin Stitt wrote: > On Tue, Oct 10, 2023 at 4:20 AM Vladimir Oltean wrote: > > Here you don't use "%s", but everywhere else you do. Can't you just pass > > the counter name everywhere, without "%s"? > > Because it's a string literal, no warning there. M

Re: [PATCH] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Vladimir Oltean
On Tue, Oct 10, 2023 at 10:44:42AM -0700, Justin Stitt wrote: > Wow, thanks for the feedback here. I agree that the current > proposal is problematic. I wonder what you think about > using a ternary to avoid smelly code dupe: > > for (i = 0; i < 3; i++) { > cnt = vsc73xx_find_counter(vsc,

[PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-10 Thread Justin Stitt
-strncpy-drivers-net-ethernet-intel-e100-c-v1-1-ca0ff9686...@google.com/ 2) https://lore.kernel.org/all/20231010-strncpy-drivers-net-ethernet-intel-e1000-e1000_main-c-v1-1-b1d64581f...@google.com/ 3) https://lore.kernel.org/all/20231010-strncpy-drivers-net-ethernet-intel-fm10k-fm10k_ethtool-c-v1-1

[PATCH v1 net-next 1/7] e100: replace deprecated strncpy with strscpy

2023-10-10 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. The "...-1" pattern makes it evident that netdev->name is expected to be NUL-terminated. Meanwhile, it seems NUL-padding is not required due to

[PATCH v1 net-next 3/7] fm10k: replace deprecated strncpy with strscpy

2023-10-10 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. A suitable replacement is `strscpy` [2] due to the fact that it guarantees NUL-termination on the destination buffer without unnecessarily NUL-pa

[PATCH v1 net-next 4/7] i40e: use scnprintf over strncpy+strncat

2023-10-10 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. Moreover, `strncat` shouldn't really be used either as per fortify-string.h: * Do not use this function. While FORTIFY_SOURCE tries to avoid *

[PATCH v1 net-next 2/7] e1000: replace deprecated strncpy with strscpy

2023-10-10 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 can see that netdev->name is expected to be NUL-terminated based on it's usage with format strings: | pr_info("%s NIC Link is Down\n", |

[PATCH v1 net-next 5/7] igb: replace deprecated strncpy with strscpy

2023-10-10 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 see that netdev->name is expected to be NUL-terminated based on its usage with format strings: | sprintf(q_vector->name, "%s-TxRx-%u", n

[PATCH v1 net-next 6/7] igbvf: replace deprecated strncpy with strscpy

2023-10-10 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 netdev->name to be NUL-terminated based on its usage with `strlen` and format strings: | if (strlen(netdev->name) < (IFNAMSIZ - 5

[PATCH v1 net-next 7/7] igc: replace deprecated strncpy with strscpy

2023-10-10 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 netdev->name to be NUL-terminated based on its use with format strings: | if (q_vector->rx.ring && q_vector->tx.ring) |

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 02:07:17PM +0300, Vladimir Oltean wrote: > Hello Justin, > > On Mon, Oct 09, 2023 at 10:43:59PM +, 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 >

[PATCH v2] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 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. ethtool_sprintf() is designed specifically for get_strings() usage. Let's replace strncpy in favor of this more robust and easier to understand i

Re: [PATCH] e100: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 > change-id: 20231009-strncpy-drivers-net-ethernet-intel-e100-c-4547179d9f2c > > Best regards, > -- > Justin Stitt > Hi, this patch was bundled up with some others. It has a new home: https://lore.kernel.org/all/20231010-netdev-replace-strncpy-resend-as-series-v1-0-caf9f0f2f...@google.com/

Re: [PATCH] e1000: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
zeof(netdev->name) - 1); > + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); > > adapter->bd_number = cards_found; > > > --- > base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 > change-id: > 20231010-strncpy-drivers-net-ether

Re: [PATCH] fm10k: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
fo->bus_info, pci_name(interface->pdev), > - sizeof(info->bus_info) - 1); > + strscpy(info->driver, fm10k_driver_name, > + sizeof(info->driver)); > + strscpy(info->bus_info, pci_name(interface->pdev), > + sizeof(info->b

Re: [PATCH] i40e: use scnprintf over strncpy+strncat

2023-10-10 Thread Justin Stitt
t; + I40E_DDP_PROFILE_PATH, flash->data); > + > /* Load DDP recipe. */ > status = request_firmware(&ddp_config, profile_name, > &netdev->dev); > > --- > base-commit: cbf3a2cb15

Re: [PATCH] igb: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
eof(netdev->name) - 1); > + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); > > netdev->mem_start = pci_resource_start(pdev, 0); > netdev->mem_end = pci_resource_end(pdev, 0); > > --- > base-commit: cbf3a2cb156a2c911d8f38d8247814b4

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
pci_name(pdev), sizeof(netdev->name) - 1); > + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); > > adapter->bd_number = cards_found++; > > > --- > base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 > change-id: > 20231010-strncpy-drivers-net-ethernet-intel-igbvf-ne

Re: [PATCH] igc: replace deprecated strncpy with strscpy

2023-10-10 Thread Justin Stitt
t; igc_get_hw_control(adapter); > > - strncpy(netdev->name, "eth%d", IFNAMSIZ); > + strscpy(netdev->name, "eth%d", sizeof(netdev->name)); > err = register_netdev(netdev); > if (err) > goto err_register; > > ---

Re: [PATCH][next] hostap: Add __counted_by for struct prism2_download_data and use struct_size()

2023-10-10 Thread Kees Cook
On Mon, Oct 09, 2023 at 01:41:18PM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array

Re: [PATCH] ibmvnic: replace deprecated strncpy with strscpy

2023-10-10 Thread Kees Cook
On Mon, Oct 09, 2023 at 11:19:57PM +, 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. > > NUL-padding is not required as the buffer is already memset to 0: > |

Re: [PATCH][next] afs: Add __counted_by for struct afs_acl and use struct_size()

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 06:59:44AM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array

Re: [PATCH][next] atags_proc: Add __counted_by for struct buffer and use struct_size()

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 06:46:50AM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array

2-member sized buffer structs struct_size()

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 03:53:28PM -0700, Kees Cook wrote: > It's surprising how many of these 2-member structs we have in the kernel > that do the same basic thing. :) 75. We have 75 of them: // Options: --all-includes @sized_byte_buffer@ identifier NAME, SIZE, ARRAY; typedef s8, s16, s32, s64;

Re: [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-10 Thread Jesse Brandeburg
> Previously, each of these patches was sent individually at: > 1) > https://lore.kernel.org/all/20231009-strncpy-drivers-net-ethernet-intel-e100-c-v1-1-ca0ff9686...@google.com/ > 2) > https://lore.kernel.org/all/20231010-strncpy-drivers-net-ethernet-intel-e1000-e1000

Re: [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-10 Thread Justin Stitt
or trailing > > NUL-bytes. Nonetheless, we should favor more robust and less ambiguous > > interfaces. > > > > Previously, each of these patches was sent individually at: > > 1) > > https://lore.kernel.org/all/20231009-strncpy-drivers-net-ethernet-intel-e100-c-v1

Re: [PATCH][next] hostap: Add __counted_by for struct prism2_download_data and use struct_size()

2023-10-10 Thread Gustavo A. R. Silva
I realize I didn't actually send my R-b for this thread, so here it is: Reviewed-by: Kees Cook :) Thanks! :) -- Gustavo

Re: [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-10 Thread Kees Cook
these patches was sent individually at: > > > 1) > > > https://lore.kernel.org/all/20231009-strncpy-drivers-net-ethernet-intel-e100-c-v1-1-ca0ff9686...@google.com/ > > > 2) > > > https://lore.kernel.org/all/20231010-strncpy-drivers-net-ethernet-intel-e1

Re: [PATCH net-next 0/7] net: intel: replace deprecated strncpy uses

2023-10-10 Thread Kees Cook
interfaces. > > Previously, each of these patches was sent individually at: > 1) > https://lore.kernel.org/all/20231009-strncpy-drivers-net-ethernet-intel-e100-c-v1-1-ca0ff9686...@google.com/ > 2) > https://lore.kernel.org/all/20231010-strncpy-drivers-net-ethernet-intel-e

Re: [PATCH v2] net: dsa: vsc73xx: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 10:32:35PM +, 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. > > ethtool_sprintf() is designed specifically for get_strings() usage. > Let

Re: [PATCH] net: mvpp2: replace deprecated strncpy with strscpy

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 09:24:42PM +, 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 `irqname` to be NUL-terminated based on its use with > of_irq_g

Re: [PATCH] octeontx2-af: replace deprecated strncpy with strscpy

2023-10-10 Thread Kees Cook
On Tue, Oct 10, 2023 at 09:38:11PM +, 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 can see that linfo->lmac_type is expected to be NUL-terminated based >

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Jakub Kicinski
On Tue, 10 Oct 2023 14:41:10 -0700 Justin Stitt wrote: > > Thanks Justin for these patches, please make sure you mark the subject > > line as per the netdev rules: > > [PATCH net-next v1] etc etc > > Sure, I'll resend! Please do read the netdev rules Jesse pointed you at. Maybe it's the combine

Re: [PATCH] igbvf: replace deprecated strncpy with strscpy

2023-10-10 Thread Jakub Kicinski
On Tue, 10 Oct 2023 17:47:31 -0700 Jakub Kicinski wrote: > Please do read the netdev rules Jesse pointed you at. > Maybe it's the combined flow of strncpy and __counted_by patches > but managing the state of the "hardening" patches is getting > a bit tedious :( > > Please group them into reasonab

Re: [PATCH] net: dsa: qca8k: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Mon, 09 Oct 2023 18:34:45 + you 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. > > ethtool

Re: [PATCH] net: dsa: realtek: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Mon, 09 Oct 2023 22:47:37 + you 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. > > ethtool

Re: [PATCH] net: dsa: realtek: rtl8365mb: replace deprecated strncpy with ethtool_sprintf

2023-10-10 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Mon, 09 Oct 2023 22:43:59 + you 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. > > ethtool

RE: [PATCH] wifi: rtw89: coex: Annotate struct rtw89_btc_btf_set_slot_table with __counted_by

2023-10-10 Thread Ping-Ke Shih
Hi Kees, > -Original Message- > From: Kees Cook > Sent: Tuesday, October 10, 2023 12:56 AM > To: Ping-Ke Shih > Cc: kv...@kernel.org; l...@lists.linux.dev; linux-ker...@vger.kernel.org; > linux-wirel...@vger.kernel.org; > linux-hardening@vger.kernel.org; t...@redhat.com; nat...@kernel.o