Re: [PATCH] clk: ti: use kcalloc() instead of kzalloc()

2025-01-06 Thread Stephen Boyd
Quoting Ethan Carter Edwards (2024-12-29 21:28:58) > Use 2-factor multiplication argument form kcalloc() instead > of kzalloc(). > > Link: https://github.com/KSPP/linux/issues/162 > > Signed-off-by: Ethan Carter Edwards > --- Applied to clk-next

Re: [PATCH] drivers: clk: clk-en7523.c: Initialize num before accessing hws in en7523_register_clocks

2024-12-03 Thread Stephen Boyd
Quoting Haoyu Li (2024-12-03 06:29:15) > With the new __counted_by annocation in clk_hw_onecell_data, the "num" > struct member must be set before accessing the "hws" array. Failing to > do so will trigger a runtime warning when enabling CONFIG_UBSAN_BOUNDS > and CONFIG_FORTIFY_SOURCE. > > Fixes:

Re: [PATCH] clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access

2024-11-14 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2024-11-14 15:55:16) > Flexible-array member `hws` in `struct clk_hw_onecell_data` is annotated > with the `counted_by()` attribute. This means that when memory is > allocated for this array, the _counter_, which in this case is member > `num` in the flexible structure,

Re: [PATCH] clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider

2024-11-14 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2024-11-14 14:49:21) > Some heap space is allocated for the flexible structure `struct > clk_hw_onecell_data` and its flexible-array member `hws` through > the composite structure `struct loongson2_clk_provider` in function > `loongson2_clk_probe()`, as shown below: >

Re: [PATCH 2/2] clk: bcm: rpi: Assign ->num before accessing ->hws

2024-04-29 Thread Stephen Boyd
Quoting Nathan Chancellor (2024-04-25 09:55:52) > Commit f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with > __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' > with __counted_by, which informs the bounds sanitizer about the number > of elements in hws, so that it c

Re: [PATCH 1/2] clk: bcm: dvp: Assign ->num before accessing ->hws

2024-04-29 Thread Stephen Boyd
Quoting Nathan Chancellor (2024-04-25 09:55:51) > Commit f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with > __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' > with __counted_by, which informs the bounds sanitizer about the number > of elements in hws, so that it c

Re: [PATCH] clk: hisilicon: Use devm_kcalloc() instead of devm_kzalloc()

2024-02-21 Thread Stephen Boyd
Quoting Erick Archer (2024-01-21 06:29:46) > As noted in the "Deprecated Interfaces, Language Features, Attributes, > and Conventions" documentation [1], size calculations (especially > multiplication) should not be performed in memory allocator (or similar) > function arguments due to the risk of

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

2024-02-02 Thread Stephen Boyd
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@vger.kernel.org > Signed-off-by: Justin Stitt > --- Reviewed-by: Stephen Boyd

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

2023-12-19 Thread Stephen Boyd
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@vger.kernel.org > Signed-off-by: Justin Stitt > --- Reviewed-by: Stephen Boyd

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

2023-12-13 Thread Stephen Boyd
Quoting Justin Stitt (2023-12-11 16:42:52) > diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c > index 438f9c9aba6e..e3bc30b57b19 100644 > --- a/drivers/iio/proximity/sx9324.c > +++ b/drivers/iio/proximity/sx9324.c > @@ -873,6 +873,32 @@ static int sx9324_init_compensatio

Re: [PATCH 1/9] arm64: dts: qcom: sc7180: Make watchdog bark interrupt edge triggered

2023-11-06 Thread Stephen Boyd
7;t get "We'll get one" twice? > another one until the "bark" interrupt is cleared and asserts again. > > This matches how many older Qualcomm SoCs have things configured. > > Fixes: 28cc13e4060c ("arm64: dts: qcom: sc7180: Add watchdog bark interrupt") > Signed-off-by: Douglas Anderson > --- Reviewed-by: Stephen Boyd

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

2023-10-30 Thread Stephen Boyd
Quoting Jonathan Cameron (2023-10-28 08:26:38) > On Thu, 26 Oct 2023 23:53:28 + > 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. > > > > For the cas

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

2023-10-23 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2023-10-23 20:31:42) > 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 tha

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

2023-10-23 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2023-10-23 20:30:52) > `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 in

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

2023-10-23 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2023-10-23 19:48:00) > > >> Fixes: b4cbe606dc36 ("clk: visconti: Add support common clock driver and > >> reset driver") > >> Cc: sta...@vger.kernel.org > >> Reviewed-by: Kees Cook > >> Acked-by: Nobuhiro Iwamatsu > >> Signed-off-by: Gustavo A. R. Silva > >> --- >

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

2023-10-23 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2023-10-16 15:06:16) > 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 tha

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

2023-10-23 Thread Stephen Boyd
Quoting Gustavo A. R. Silva (2023-10-16 15:05:27) > `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 in