WSL2-Linux-Kernel/drivers/clk/samsung
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 clk: samsung: Allow modular build of the Audio Subsystem CLKCON driver 2016-07-13 14:59:53 -07:00
Makefile clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5 sub-CMU 2018-03-06 17:39:40 +01:00
clk-cpu.c clk: samsung: Delete a memory allocation error message in clk-cpu.c 2017-09-27 17:06:18 +02:00
clk-cpu.h clk: samsung: cpu: prepare for adding Exynos5433 CPU clocks 2016-06-02 11:18:20 +02:00
clk-exynos-audss.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
clk-exynos-clkout.c treewide: Use struct_size() for kmalloc()-family 2018-06-06 11:15:43 -07:00
clk-exynos4.c clk: samsung: Add fout=196608001 Hz EPLL rate entry for exynos4412 2018-03-15 19:27:29 +01:00
clk-exynos5-subcmu.c clk: samsung: exynos5250: Move PD-dependent clocks to Exynos5 sub-CMU 2018-03-06 17:39:40 +01:00
clk-exynos5-subcmu.h clk: samsung: Add Exynos5 sub-CMU clock driver 2018-03-06 17:38:46 +01:00
clk-exynos7.c clk: samsung: Add compile time PLL rate validators 2018-02-23 15:15:20 +01:00
clk-exynos3250.c clk: samsung: Add compile time PLL rate validators 2018-02-23 15:15:20 +01:00
clk-exynos4412-isp.c clk: samsung: Add a separate driver for Exynos4412 ISP clocks 2017-10-16 11:25:50 +02:00
clk-exynos5250.c clk: samsung: exynos5250: Add missing clocks for FIMC LITE SYSMMU devices 2018-03-14 12:12:11 +01:00
clk-exynos5260.c clk: samsung: Add compile time PLL rate validators 2018-02-23 15:15:20 +01:00
clk-exynos5260.h
clk-exynos5410.c clk: samsung: Add compile time PLL rate validators 2018-02-23 15:15:20 +01:00
clk-exynos5420.c clk: samsung: exynos5420: Add more entries to EPLL rate table 2018-03-12 11:23:27 +01:00
clk-exynos5433.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
clk-exynos5440.c clk: samsung: Rework clkdev alias handling in Exynos5440 driver 2017-10-09 11:32:09 +02:00
clk-pll.c clk/samsung updates for v4.15 2017-10-25 02:37:03 -07:00
clk-pll.h clk: samsung: Add compile time PLL rate validators 2018-02-23 15:15:20 +01:00
clk-s3c64xx.c clk: samsung: s3c: Remove unneeded enumeration 2018-02-14 15:40:53 +01:00
clk-s3c2410-dclk.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
clk-s3c2410.c clk: samsung: Mark a few things static 2018-03-16 09:23:17 -07:00
clk-s3c2412.c clk: samsung: Mark a few things static 2018-03-16 09:23:17 -07:00
clk-s3c2443.c clk: samsung: Mark a few things static 2018-03-16 09:23:17 -07:00
clk-s5pv210-audss.c treewide: Use struct_size() for devm_kmalloc() and friends 2018-06-06 11:15:43 -07:00
clk-s5pv210.c
clk.c clk/samsung updates for v4.15 2017-10-25 02:37:03 -07:00
clk.h clk/samsung updates for v4.15 2017-10-25 02:37:03 -07:00