WSL2-Linux-Kernel/drivers/clk/qcom
Kees Cook 0ed2dd03b9 treewide: Use struct_size() for devm_kmalloc() and friends
Replaces open-coded struct size calculations with struct_size() for
devm_*, f2fs_*, and sock_* allocations. Automatically generated (and
manually adjusted) from the following Coccinelle script:

// Direct reference to struct field.
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@

- alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
+ alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)

// mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
identifier VAR, ELEMENT;
expression COUNT;
@@

- alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
+ alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP)

// Same pattern, but can't trivially locate the trailing element name,
// or variable name.
@@
identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc";
expression HANDLE;
expression GFP;
expression SOMETHING, COUNT, ELEMENT;
@@

- alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
+ alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-06 11:15:43 -07:00
..
Kconfig Merge branches 'clk-iproc', 'clk-mvebu' and 'clk-qcom-a53' into clk-next 2018-01-26 16:41:58 -08:00
Makefile Merge branches 'clk-iproc', 'clk-mvebu' and 'clk-qcom-a53' into clk-next 2018-01-26 16:41:58 -08:00
a53-pll.c clk: qcom: Add A53 PLL support 2018-01-02 10:00:24 -08:00
apcs-msm8916.c clk: qcom: msm8916: Fix return value check in qcom_apcs_msm8916_clk_probe() 2018-03-12 15:14:24 -07:00
clk-alpha-pll.c clk: qcom: add read-only alpha pll post divider operations 2017-12-13 16:54:10 -08:00
clk-alpha-pll.h clk: qcom: add read-only alpha pll post divider operations 2017-12-13 16:54:10 -08:00
clk-branch.c clk: Convert __clk_get_name(hw->clk) to clk_hw_get_name(hw) 2015-08-24 16:49:12 -07:00
clk-branch.h clk: qcom: Add support for branches/gate clocks 2014-01-16 12:01:01 -08:00
clk-pll.c clk: qcom: Enable FSM mode for votable alpha PLLs 2016-11-01 18:39:17 -07:00
clk-pll.h clk: qcom: Add support for SR2 PLLs 2015-07-07 17:19:58 -07:00
clk-rcg.c clk: qcom: Fix pre-divider usage for pixel RCG 2016-02-29 12:57:06 -08:00
clk-rcg.h clk: qcom: add parent map for regmap mux 2017-12-21 16:03:22 -08:00
clk-rcg2.c clk: qcom: Remove unused RCG ops 2017-11-01 23:43:42 -07:00
clk-regmap-divider.c clk: qcom: use divider_ro_round_rate helper 2018-03-12 15:10:27 -07:00
clk-regmap-divider.h clk: qcom: add read-only divider operations 2017-12-21 16:03:19 -08:00
clk-regmap-mux-div.c clk: qcom: Add regmap mux-div clocks support 2018-01-02 10:00:24 -08:00
clk-regmap-mux-div.h clk: qcom: Add regmap mux-div clocks support 2018-01-02 10:00:24 -08:00
clk-regmap-mux.c clk: qcom: add parent map for regmap mux 2017-12-21 16:03:22 -08:00
clk-regmap-mux.h clk: qcom: add parent map for regmap mux 2017-12-21 16:03:22 -08:00
clk-regmap.c clk: qcom: Migrate to clk_hw based registration and OF APIs 2016-08-24 17:37:06 -07:00
clk-regmap.h clk: qcom: Migrate to clk_hw based registration and OF APIs 2016-08-24 17:37:06 -07:00
clk-rpm.c clk: qcom: rpmcc: Add support to XO buffered clocks 2018-03-19 14:40:26 -07:00
clk-smd-rpm.c clk: qcom: smd-rpm: Migrate to devm_of_clk_add_hw_provider() 2018-03-16 15:52:39 -07:00
clk-spmi-pmic-div.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
common.c clk: qcom: common: fix legacy board-clock registration 2017-11-14 15:53:29 -08:00
common.h clk: qcom: add parent map for regmap mux 2017-12-21 16:03:22 -08:00
gcc-apq8084.c clk: qcom: Move all sdcc rcgs to use clk_rcg2_floor_ops 2016-11-23 11:00:06 -08:00
gcc-ipq806x.c clk: qcom: ipq806x: Fix board clk rates 2016-11-09 17:10:32 -08:00
gcc-ipq4019.c clk: qcom: ipq4019: Add the cpu clock frequency change notifier 2016-12-27 13:44:34 -08:00
gcc-ipq8074.c clk: qcom: ipq8074: add misc resets for PCIE and NSS 2017-12-21 16:03:40 -08:00
gcc-mdm9615.c clk: mdm9615: Add EBI2 clock 2017-01-09 16:33:26 -08:00
gcc-msm8660.c clk: qcom: add EBI2 clocks to the MSM8660 GCC 2016-07-01 18:12:45 -07:00
gcc-msm8916.c clk: qcom: msm8916: add 12.288 MHz support to codec dig clk 2017-12-06 22:34:09 -08:00
gcc-msm8960.c clk: qcom: Remove CLK_IS_ROOT 2016-03-04 12:53:53 -08:00
gcc-msm8974.c clk: qcom: Move all sdcc rcgs to use clk_rcg2_floor_ops 2016-11-23 11:00:06 -08:00
gcc-msm8994.c clk: qcom: support for alpha pll properties 2017-12-13 13:45:30 -08:00
gcc-msm8996.c clk: qcom: gcc-msm8996: Mark aggre0 noc clks as critical 2018-03-16 15:35:35 -07:00
gdsc.c clk: qcom: gdsc: Fix handling of hw control enable/disable 2017-01-26 16:00:38 -08:00
gdsc.h clk: qcom: gdsc: Add support for gdscs with HW control 2016-11-23 16:41:15 -08:00
lcc-ipq806x.c clk: qcom: lcc-ipq806x: Fixup overriding val in regmap_read call 2016-11-01 17:44:09 -07:00
lcc-mdm9615.c clk: mdm9615: Add support for MDM9615 Clock Controllers 2016-08-15 15:51:21 -07:00
lcc-msm8960.c Revert "clk: qcom: Specify LE device endianness" 2016-02-12 14:24:24 -08:00
mmcc-apq8084.c Revert "clk: qcom: Specify LE device endianness" 2016-02-12 14:24:24 -08:00
mmcc-msm8960.c clk: qcom: Remove CLK_IS_ROOT 2016-03-04 12:53:53 -08:00
mmcc-msm8974.c Merge branch 'clk-fixes' into clk-next 2016-02-18 19:17:29 -08:00
mmcc-msm8996.c clk: qcom: support for alpha pll properties 2017-12-13 13:45:30 -08:00
reset.c clk: qcom: Make reset_control_ops const 2016-03-29 16:30:26 -07:00
reset.h clk: qcom: Make reset_control_ops const 2016-03-29 16:30:26 -07:00