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

2023-10-12 Thread Justin Stitt
net_device *net) --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-usb-sr9800-c-38f712c2ff72 Best regards, -- Justin Stitt

[PATCH] lan78xx: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
usb_make_path(dev->udev, info->bus_info, sizeof(info->bus_info)); } --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-usb-lan78xx-c-f19433ee0f0a Best regards, -- Justin Stitt

[PATCH] net: phy: smsc: replace deprecated strncpy with ethtool_sprintf

2023-10-12 Thread Justin Stitt
g, ETH_GSTRING_LEN); - } + for (i = 0; i < ARRAY_SIZE(smsc_hw_stats); i++) + ethtool_sprintf(&data, "%s", smsc_hw_stats[i].string); } static u64 smsc_get_stat(struct phy_device *phydev, int i) --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 2023

[PATCH] net: phy: tja11xx: replace deprecated strncpy with ethtool_sprintf

2023-10-12 Thread Justin Stitt
2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-phy-nxp-tja11xx-c-99019080b1d4 Best regards, -- Justin Stitt

[PATCH] net: phy: replace deprecated strncpy with ethtool_sprintf

2023-10-12 Thread Justin Stitt
100btx_rx_err"); } static void cbtx_get_stats(struct phy_device *phydev, --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-phy-nxp-cbtx-c-266285682759 Best regards, -- Justin Stitt

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

2023-10-12 Thread Justin Stitt
On Thu, Oct 12, 2023 at 2:59 PM Andrew Lunn wrote: > > On Thu, Oct 12, 2023 at 09:53:03PM +, 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. > > Hi Justin >

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

2023-10-12 Thread Andrew Lunn
On Thu, Oct 12, 2023 at 09:53:03PM +, 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. Hi Justin You just sent two patches with the same Subject. That got me confu

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

2023-10-12 Thread Andrew Lunn
On Thu, Oct 12, 2023 at 09:43:02PM +, 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 >

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

2023-10-12 Thread Justin Stitt
trscpy(mdiodev->modalias, bi->modalias, sizeof(mdiodev->modalias)); mdiodev->bus_match = mdio_device_bus_match; mdiodev->dev.platform_data = (void *)bi->platform_data; --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-s

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

2023-10-12 Thread Justin Stitt
t;id, "gpio", sizeof(new_bus->id)); if (pdata) { new_bus->phy_mask = pdata->phy_mask; --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-mdio-mdio-gpio-c-bddd9ed0c630 Best regards, -- Justin Stitt

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

2023-10-12 Thread Justin Stitt
wx, part_str, TXGBE_PBANUM_LENGTH); if (err) - strncpy(part_str, "Unknown", TXGBE_PBANUM_LENGTH); + strscpy(part_str, "Unknown", sizeof(part_str)); netif_info(wx, probe, netdev, "%pM\n", netdev->dev_addr); --- base-commit: cbf3a2cb156a2c

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

2023-10-12 Thread Kees Cook
On Thu, Oct 12, 2023 at 08:38:19PM +, 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. > > `desc` is expected to be NUL-terminated as evident by the manual > NUL-by

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

2023-10-12 Thread Justin Stitt
one_get_msglevel(struct net_device *ndev) --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-ethernet-ti-netcp_ethss-c-305a53873cfc Best regards, -- Justin Stitt

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

2023-10-12 Thread Edward Cree
On 12/10/2023 21:38, 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. > > `desc` is expected to be NUL-terminated as evident by the manual > NUL-byte assignment. Moreov

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

2023-10-12 Thread Justin Stitt
eof(mdio_bus_id) - 1] = '\0'; dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); if (!dev) --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-ethernet-ti-cpmac-c-9d9d1b33d595 Best regards, -- Justin Stitt

[PATCH] sfc: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
ESCRIPTION), MC_CMD_NVRAM_METADATA_OUT_DESCRIPTION_NUM(outlen)); - desc[MC_CMD_NVRAM_METADATA_OUT_DESCRIPTION_NUM(outlen)] = '\0'; } else { desc[0] = '\0'; } --- base-commit: cbf3a2cb156a2c911d8f38d8247814

Re: [PATCH] arm64: dts: exynos: Add reserved memory for pstore on E850-96

2023-10-12 Thread Krzysztof Kozlowski
On 12/10/2023 22:02, Krzysztof Kozlowski wrote: > > On Sat, 07 Oct 2023 22:36:33 -0500, Sam Protsenko wrote: >> Reserve a 2 MiB memory region to record kmsg dumps, console, ftrace and >> userspace messages. The implemented memory split allows capturing and >> reading corresponding ring buffers: >>

Re: [PATCH] arm64: dts: exynos: Add reserved memory for pstore on E850-96

2023-10-12 Thread Krzysztof Kozlowski
On Sat, 07 Oct 2023 22:36:33 -0500, Sam Protsenko wrote: > Reserve a 2 MiB memory region to record kmsg dumps, console, ftrace and > userspace messages. The implemented memory split allows capturing and > reading corresponding ring buffers: > * dmesg: 6 dumps, 128 KiB each > * console: 128 Ki

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

2023-10-12 Thread Rob Herring
On Thu, Oct 12, 2023 at 2:53 PM Rob Herring wrote: > > On Tue, Oct 10, 2023 at 07:27:19PM +0200, Duje Mihanović wrote: > > Add the "marvell,pxa1908-padconf" compatible to allow migrating to a > > separate pinctrl driver later. > > > > Signed-off-by: Duje Mihanović > > --- > > Documentation/devic

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

2023-10-12 Thread Rob Herring
On Tue, Oct 10, 2023 at 07:27:19PM +0200, Duje Mihanović wrote: > 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 chang

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

2023-10-12 Thread Krzysztof Kozlowski
On 10/10/2023 19:27, Duje Mihanović wrote: > 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(+) >

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

2023-10-12 Thread Jacob Keller
On 10/10/2023 3:26 PM, Justin Stitt wrote: > Hi, > > This series aims to eliminate uses of strncpy() as it is a deprecated > interface [1] with many viable replacements available. > > Predominantly, strscpy() is the go-to replacement as it guarantees > NUL-termination on the destination buffer

Re: [PATCH] net/mlx5: Annotate struct mlx5_flow_handle with __counted_by

2023-10-12 Thread Saeed Mahameed
On 03 Oct 16:17, Kees Cook 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) and CONFIG_FORTIFY_SOURCE (for

Re: [PATCH] net/mlx5: Annotate struct mlx5_fc_bulk with __counted_by

2023-10-12 Thread Saeed Mahameed
On 03 Oct 16:17, Kees Cook 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) and CONFIG_FORTIFY_SOURCE (for

Re: [PATCH] net/mlx4_core: replace deprecated strncpy with strscpy

2023-10-12 Thread Saeed Mahameed
On 11 Oct 21:04, 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 `dst` to be NUL-terminated based on its use with format strings: | mlx4_dbg(dev, "Reportin

Re: [PATCH] net/mlx5: simplify mlx5_set_driver_version string assignments

2023-10-12 Thread Saeed Mahameed
On 11 Oct 14:34, Kees Cook wrote: On Wed, Oct 11, 2023 at 09:29:57PM +, Justin Stitt wrote: In total, just assigning this version string takes: (1) strncpy()'s (5) strlen()'s (3) strncat()'s (1) snprintf()'s (4) max_t()'s Moreover, `strncpy` is deprecated [1] and `strncat` really shouldn't

[PATCH] qlcnic: replace deprecated strncpy with strscpy

2023-10-12 Thread Justin Stitt
default: dev_err(&pdev->dev, "%s: Invalid device id\n", --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231012-strncpy-drivers-net-ethernet-qlogic-qlcnic-qlcnic_83xx_init-c-7858019dc583 Best regards, -- Justin Stitt

Re: [PATCH v2] qed: replace uses of strncpy

2023-10-12 Thread Kees Cook
On Thu, Oct 12, 2023 at 06:35:41PM +, 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. > > This patch eliminates three uses of strncpy(): > > Firstly, `dest` is ex

Re: [PATCH v4 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234

2023-10-12 Thread kernel test robot
Hi Kartik, kernel test robot noticed the following build warnings: [auto build test WARNING on tegra/for-next] [also build test WARNING on kees/for-next/hardening akpm-mm/mm-everything linus/master v6.6-rc5 next-20231012] [If your patch is applied to the wrong git tree, kindly drop us a note

[PATCH v2] qed: replace uses of strncpy

2023-10-12 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. This patch eliminates three uses of strncpy(): Firstly, `dest` is expected to be NUL-terminated which is evident by the manual setting of a NUL-

Re: [PATCH v3] pstore/platform: Add check for kstrdup

2023-10-12 Thread Kees Cook
On Fri, 23 Jun 2023 10:27:06 +0800, Jiasheng Jiang wrote: > Add check for the return value of kstrdup() and return the error > if it fails in order to avoid NULL pointer dereference. > > Applied to for-next/pstore, thanks! [1/1] pstore/platform: Add check for kstrdup https://git.kernel.or

Re: [PATCH 2/2][next] clk: visconti: Add bounds-checking coverage for struct visconti_pll_provider

2023-10-12 Thread Kees Cook
On Wed, Oct 11, 2023 at 08:18:45PM -0600, Gustavo A. R. Silva wrote: > In order to gain the bounds-checking coverage that __counted_by provides > to flexible-array members at run-time via CONFIG_UBSAN_BOUNDS (for array > indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions), > we

Re: [PATCH 1/2][next] clk: visconti: Fix undefined behavior bug in struct visconti_pll_provider

2023-10-12 Thread Kees Cook
On Wed, Oct 11, 2023 at 08:17:36PM -0600, Gustavo A. R. Silva wrote: > `struct clk_hw_onecell_data` is a flexible structure, which means that > it contains flexible-array member at the bottom, in this case array > `hws`: > > include/linux/clk-provider.h: > 1380 struct clk_hw_onecell_data { > 1381

Re: [PATCH] hardening: x86: drop reference to removed config AMD_IOMMU_V2

2023-10-12 Thread Kees Cook
On Thu, 12 Oct 2023 06:50:40 +0200, Lukas Bulwahn wrote: > Commit 5a0b11a180a9 ("iommu/amd: Remove iommu_v2 module") removes the > config AMD_IOMMU_V2. > > Remove the reference to this config in the x86 architecture-specific > hardening config fragment as well. > > > [...] Applied to for-next/h

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

2023-10-12 Thread Louis Peens
On Wed, Oct 11, 2023 at 09:48:39PM +, 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 res->name to be NUL-terminated based on its usage with format >

Re: [PATCH v2] wifi: p54: Annotate struct p54_cal_database with __counted_by

2023-10-12 Thread Kalle Valo
Kees Cook 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) and CONFIG_FORTIFY_SOURCE (for strcpy/m