RE: [PATCH] PCI: pciehp: Prevent child devices from doing RPM on PCIe Link Down

2023-10-16 Thread Ricky WU
> -Original Message- > From: Kai-Heng Feng > > On Mon, Oct 16, 2023 at 5:32 PM Lukas Wunner wrote: > > > > On Mon, Oct 16, 2023 at 12:01:31PM +0800, Kai-Heng Feng wrote: > > > When inserting an SD7.0 card to Realtek card reader, it can trigger > > > PCI slot Link down and causes the fo

[PATCH v7 8/8] soc/tegra: fuse: Add support for Tegra241

2023-10-16 Thread Kartik
Add support for Tegra241 which use ACPI boot. Signed-off-by: Kartik --- v1 -> v2: * Removed few entries from tegra241_fuse_soc which were initilized as NULL or 0. --- drivers/soc/tegra/Kconfig | 5 + drivers/soc/tegra/fuse/fuse-tegra.c| 5 + drivers/s

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

2023-10-16 Thread Kartik
Add ACPI support for Tegra194 & Tegra243 SoC's. This requires following modifications to the probe when ACPI boot is used: - Initialize soc data. - Add nvmem lookups. - Register soc device. - use devm_clk_get_optional() instead of devm_clk_get() to get fuse->clk, as fuse clocks are not requi

[PATCH v7 5/8] soc/tegra: fuse: Add function to add lookups

2023-10-16 Thread Kartik
Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik --- v3 -> v4: * Use kmemdup_array

[PATCH v7 6/8] soc/tegra: fuse: Add function to print SKU info

2023-10-16 Thread Kartik
Add helper function tegra_fuse_print_sku_info() to print Tegra SKU information. So, it can be shared between tegra_fuse_init() and ACPI probe which is to be introduced later. Signed-off-by: Kartik --- v1 -> v2: * Renamed tegra_fuse_pr_sku_info() as tegra_fuse_print_sku_info(). -

[PATCH v7 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()

2023-10-16 Thread Kartik
In preparation to ACPI support in Tegra fuse driver add function tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver. Also, document the reason of calling tegra_init_apbmisc() at early init. Note that function tegra_acpi_init_apbmisc() is not placed in the __init section, because it will

[PATCH v7 3/8] soc/tegra: fuse: Refactor resource mapping

2023-10-16 Thread Kartik
To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upc

[PATCH v7 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures

2023-10-16 Thread Kartik
Currently, in tegra_fuse_probe() if clock/reset get fails, then the driver prints an error if the error is not caused by -EPROBE_DEFER. This can be improved by using dev_err_probe() instead. So, return dev_err_probe() if clock/reset get fails. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/fu

[PATCH v7 1/8] mm/util: Introduce kmemdup_array()

2023-10-16 Thread Kartik
Introduce kmemdup_array() API to duplicate `n` number of elements from a given array. This internally uses kmemdup to allocate and duplicate the `src` array. Signed-off-by: Kartik Acked-by: Kees Cook --- v4 -> v5: * Simplify the implementation by just returning kmemdup(size_mul). --- in

[PATCH v7 0/8] soc/tegra: fuse: Add ACPI support

2023-10-16 Thread Kartik
This series of patches add ACPI support for Tegra194 and Tegra234 in Tegra fuse and apbmisc drivers. It also adds support for Tegra241 which uses ACPI boot. Kartik (8): mm/util: Introduce kmemdup_array() soc/tegra: fuse: Use dev_err_probe for probe failures soc/tegra: fuse: Refactor resource

Re: [PATCH] PCI: pciehp: Prevent child devices from doing RPM on PCIe Link Down

2023-10-16 Thread Kai-Heng Feng
On Mon, Oct 16, 2023 at 5:32 PM Lukas Wunner wrote: > > On Mon, Oct 16, 2023 at 12:01:31PM +0800, Kai-Heng Feng wrote: > > When inserting an SD7.0 card to Realtek card reader, it can trigger PCI > > slot Link down and causes the following error: > > Why does *inserting* a card cause a Link Down?

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

2023-10-16 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Thu, 12 Oct 2023 22:30:54 + 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. > > Other i

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

2023-10-16 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Thu, 12 Oct 2023 22:33:34 + 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. > > Other i

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

2023-10-16 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Thu, 12 Oct 2023 22:27:52 + 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: netcp: replace deprecated strncpy with strscpy

2023-10-16 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski : On Thu, 12 Oct 2023 21:05:40 + 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. > > Conside

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

2023-10-16 Thread Jakub Kicinski
On Thu, 12 Oct 2023 20:53:30 + 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 driver no longer exists. Praise be. -- pw-bot: reject

[PATCH v2] brcmfmac: replace deprecated strncpy

2023-10-16 Thread Justin Stitt
rg/testing/linux-manual-4.8/strscpy.9.en.html [2] Link: https://github.com/KSPP/linux/issues/90 Cc: linux-hardening@vger.kernel.org Signed-off-by: Justin Stitt --- Changes in v2: - add other strncpy replacements - Link to v1: https://lore.kernel.org/r/20231016-strncpy-drivers-net-wireless-broadcom-brcm80

[PATCH v2 2/2][next] clk: socfpga: agilex: Add bounds-checking coverage for struct stratix10_clock_data

2023-10-16 Thread Gustavo A. R. Silva
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 must make sure that the counter member, in this case `num`, is updated befor

[PATCH v2 1/2][next] clk: socfpga: Fix undefined behavior bug in struct stratix10_clock_data

2023-10-16 Thread Gustavo A. R. Silva
`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 unsigned int num; 1382 struct clk_hw *hws[] __counted_by(num); 1383

[PATCH v2 0/2][next] clk: socfpga: Fix undefined behavior bug and add bounds-checking coverage

2023-10-16 Thread Gustavo A. R. Silva
This series aims to fix an undefined behavior bug in `struct stratix10_clock_data` and add bounds-checking coverage at run-time for flexible-array member `hws` in `struct clk_hw_onecell_data` when accessed throught `struct stratix10_clock_data`. Changes in v2: - Mention -Wflex-array-member-not-at

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

2023-10-16 Thread Gustavo A. R. Silva
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 must make sure that the counter member, in this particular case `num`, is up

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

2023-10-16 Thread Gustavo A. R. Silva
`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 unsigned int num; 1382 struct clk_hw *hws[] __counted_by(num); 1383

[PATCH v2 0/2][next] clk: visconti: Fix undefined behavior bug and add bounds-checking coverage

2023-10-16 Thread Gustavo A. R. Silva
This small series aims to fix an undefined behavior bug in `struct visconti_pll_provider` and add bounds-checking coverage at run-time for flexible-array member `hws` in `struct clk_hw_onecell_data` when accessed throught `struct visconti_pll_provider`. Changes in v2: - Mention -Wflex-array-membe

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

2023-10-16 Thread Justin Stitt
goto fail; > } > > - strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); > + strscpy(ifp->ndev->name, name, sizeof(ifp->ndev->name)); > err = brcmf_net_attach(ifp, true); > if (err) { > bphy_err(d

[PATCH] brcmfmac: replace deprecated strncpy with strscpy

2023-10-16 Thread Justin Stitt
- strncpy(ifp->ndev->name, name, sizeof(ifp->ndev->name) - 1); + strscpy(ifp->ndev->name, name, sizeof(ifp->ndev->name)); err = brcmf_net_attach(ifp, true); if (err) { bphy_err(drvr, "Registering netdevice failed\n"); --- b

[PATCH] atmel: replace deprecated strncpy/strcpy with strscpy

2023-10-16 Thread Justin Stitt
;, + sizeof(priv->firmware_id)); } err = request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev); if (err != 0) { --- base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 change-id: 20231016-strncpy-drivers-net-wireless-atmel-atmel-c-7ca951cf7cfa Best regards, -- Justin Stitt

Re: [PATCH v5 1/8] mm/util: Introduce kmemdup_array()

2023-10-16 Thread Kees Cook
On Mon, Oct 16, 2023 at 11:04:04AM +0530, Kartik wrote: > Introduce kmemdup_array() API to duplicate `n` number of elements > from a given array. This internally uses kmemdup to allocate and duplicate > the `src` array. > > Signed-off-by: Kartik Acked-by: Kees Cook -- Kees Cook

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

2023-10-16 Thread Kees Cook
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 >

Re: [PATCH][next] soc: qcom: apr: Add __counted_by for struct apr_rx_buf and use struct_size()

2023-10-16 Thread Bjorn Andersson
On Mon, Oct 09, 2023 at 03:30:17PM -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] qlcnic: replace deprecated strncpy with strscpy

2023-10-16 Thread Justin Stitt
On Sat, Oct 14, 2023 at 7:47 PM Kees Cook wrote: > > On Thu, Oct 12, 2023 at 07:44:29PM +, 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

Re: [PATCH][next] ASoC: sigmadsp: Add __counted_by for struct sigmadsp_data and use struct_size()

2023-10-16 Thread Mark Brown
On Mon, 09 Oct 2023 15:24:23 -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 index

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

2023-10-16 Thread Andy Shevchenko
On Mon, Oct 16, 2023 at 03:44:35PM +0530, Kartik wrote: > Add ACPI support for Tegra194 & Tegra243 SoC's. This requires > following modifications to the probe when ACPI boot is used: > - Initialize soc data. > - Add nvmem lookups. > - Register soc device. > - use devm_clk_get_optional() instead

Re: [PATCH v5 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()

2023-10-16 Thread Kartik
On Mon, 2023-10-16 at 07:41 +0200, Christophe JAILLET wrote: > > + /* > > +* Get required memory resources. > > +* > > +* resources[0]: apbmisc. > > +* resources[1]: straps. > > +*/ > > + resource_list_for_each_entry_safe(rentry, tmp, &resource_list) { > > Nit: Is the 'safe

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

2023-10-16 Thread Kartik
Add ACPI support for Tegra194 & Tegra243 SoC's. This requires following modifications to the probe when ACPI boot is used: - Initialize soc data. - Add nvmem lookups. - Register soc device. - use devm_clk_get_optional() instead of devm_clk_get() to get fuse->clk, as fuse clocks are not requi

[PATCH v6 8/8] soc/tegra: fuse: Add support for Tegra241

2023-10-16 Thread Kartik
Add support for Tegra241 which use ACPI boot. Signed-off-by: Kartik --- v1 -> v2: * Removed few entries from tegra241_fuse_soc which were initilized as NULL or 0. --- drivers/soc/tegra/Kconfig | 5 + drivers/soc/tegra/fuse/fuse-tegra.c| 5 + drivers/s

[PATCH v6 6/8] soc/tegra: fuse: Add function to print SKU info

2023-10-16 Thread Kartik
Add helper function tegra_fuse_print_sku_info() to print Tegra SKU information. So, it can be shared between tegra_fuse_init() and ACPI probe which is to be introduced later. Signed-off-by: Kartik --- v1 -> v2: * Renamed tegra_fuse_pr_sku_info() as tegra_fuse_print_sku_info(). -

[PATCH v6 5/8] soc/tegra: fuse: Add function to add lookups

2023-10-16 Thread Kartik
Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik --- v3 -> v4: * Use kmemdup_array

[PATCH v6 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc()

2023-10-16 Thread Kartik
In preparation to ACPI support in Tegra fuse driver add function tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver. Also, document the reason of calling tegra_init_apbmisc() at early init. Note that function tegra_acpi_init_apbmisc() is not placed in the __init section, because it will

[PATCH v6 3/8] soc/tegra: fuse: Refactor resource mapping

2023-10-16 Thread Kartik
To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upc

[PATCH v6 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures

2023-10-16 Thread Kartik
Currently, in tegra_fuse_probe() if clock/reset get fails, then the driver prints an error if the error is not caused by -EPROBE_DEFER. This can be improved by using dev_err_probe() instead. So, return dev_err_probe() if clock/reset get fails. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/fu

[PATCH v6 0/8] soc/tegra: fuse: Add ACPI support

2023-10-16 Thread Kartik
This series of patches add ACPI support for Tegra194 and Tegra234 in Tegra fuse and apbmisc drivers. It also adds support for Tegra241 which uses ACPI boot. Kartik (8): mm/util: Introduce kmemdup_array() soc/tegra: fuse: Use dev_err_probe for probe failures soc/tegra: fuse: Refactor resource

[PATCH v6 1/8] mm/util: Introduce kmemdup_array()

2023-10-16 Thread Kartik
Introduce kmemdup_array() API to duplicate `n` number of elements from a given array. This internally uses kmemdup to allocate and duplicate the `src` array. Signed-off-by: Kartik --- v4 -> v5: * Simplify the implementation by just returning kmemdup(size_mul). --- include/linux/string.h

Re: [PATCH] PCI: pciehp: Prevent child devices from doing RPM on PCIe Link Down

2023-10-16 Thread Lukas Wunner
On Mon, Oct 16, 2023 at 12:01:31PM +0800, Kai-Heng Feng wrote: > When inserting an SD7.0 card to Realtek card reader, it can trigger PCI > slot Link down and causes the following error: Why does *inserting* a card cause a Link Down? > [ 63.898861] pcieport :00:1c.0: pciehp: Slot(8): Link D

Re: [PATCH] mtd: rawnand: rockchip: Use struct_size()

2023-10-16 Thread Miquel Raynal
On Sun, 2023-10-01 at 07:44:04 UTC, Christophe JAILLET wrote: > Use struct_size() instead of hand writing it. > This is less verbose and more robust. > > While at it, prepare for the coming implementation by GCC and Clang of the > __counted_by attribute. Flexible array members annotated with __cou

Re: [PATCH] mtd: rawnand: Annotate struct mtk_nfc_nand_chip with __counted_by

2023-10-16 Thread Miquel Raynal
On Fri, 2023-10-06 at 20:17:28 UTC, 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 C

Re: [PATCH] mtd: rawnand: cadence: Annotate struct cdns_nand_chip with __counted_by

2023-10-16 Thread Miquel Raynal
On Fri, 2023-10-06 at 20:17:34 UTC, 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 C

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

2023-10-16 Thread Pucha, HimasekharX Reddy
> -Original Message- > From: Intel-wired-lan On Behalf Of > Justin Stitt > Sent: Wednesday, October 11, 2023 3:57 AM > To: Brandeburg, Jesse ; Nguyen, Anthony L > ; David S. Miller ; Eric > Dumazet ; Jakub Kicinski ; Paolo Abeni > > Cc: net...@vger.kernel.org; Justin Stitt ; > intel-

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

2023-10-16 Thread Pucha, HimasekharX Reddy
> -Original Message- > From: Intel-wired-lan On Behalf Of > Justin Stitt > Sent: Wednesday, October 11, 2023 3:57 AM > To: Brandeburg, Jesse ; Nguyen, Anthony L > ; David S. Miller ; Eric > Dumazet ; Jakub Kicinski ; Paolo Abeni > > Cc: net...@vger.kernel.org; Justin Stitt ; > intel-

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

2023-10-16 Thread Pucha, HimasekharX Reddy
> -Original Message- > From: Intel-wired-lan On Behalf Of > Justin Stitt > Sent: Wednesday, October 11, 2023 3:57 AM > To: Brandeburg, Jesse ; Nguyen, Anthony L > ; David S. Miller ; Eric > Dumazet ; Jakub Kicinski ; Paolo Abeni > > Cc: net...@vger.kernel.org; Justin Stitt ; > intel-

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

2023-10-16 Thread Pucha, HimasekharX Reddy
> -Original Message- > From: Intel-wired-lan On Behalf Of > Justin Stitt > Sent: Wednesday, October 11, 2023 3:57 AM > To: Brandeburg, Jesse ; Nguyen, Anthony L > ; David S. Miller ; Eric > Dumazet ; Jakub Kicinski ; Paolo Abeni > > Cc: net...@vger.kernel.org; Justin Stitt ; > intel-

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

2023-10-16 Thread Joerg Roedel
On Mon, Oct 09, 2023 at 12:24:27PM -0600, Gustavo A. R. Silva wrote: > drivers/iommu/virtio-iommu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied, thanks.