mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-20 11:34:02 +08:00
0ed2dd03b9
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> |
||
---|---|---|
.. | ||
a53-pll.c | ||
apcs-msm8916.c | ||
clk-alpha-pll.c | ||
clk-alpha-pll.h | ||
clk-branch.c | ||
clk-branch.h | ||
clk-pll.c | ||
clk-pll.h | ||
clk-rcg2.c | ||
clk-rcg.c | ||
clk-rcg.h | ||
clk-regmap-divider.c | ||
clk-regmap-divider.h | ||
clk-regmap-mux-div.c | ||
clk-regmap-mux-div.h | ||
clk-regmap-mux.c | ||
clk-regmap-mux.h | ||
clk-regmap.c | ||
clk-regmap.h | ||
clk-rpm.c | ||
clk-smd-rpm.c | ||
clk-spmi-pmic-div.c | ||
common.c | ||
common.h | ||
gcc-apq8084.c | ||
gcc-ipq806x.c | ||
gcc-ipq4019.c | ||
gcc-ipq8074.c | ||
gcc-mdm9615.c | ||
gcc-msm8660.c | ||
gcc-msm8916.c | ||
gcc-msm8960.c | ||
gcc-msm8974.c | ||
gcc-msm8994.c | ||
gcc-msm8996.c | ||
gdsc.c | ||
gdsc.h | ||
Kconfig | ||
lcc-ipq806x.c | ||
lcc-mdm9615.c | ||
lcc-msm8960.c | ||
Makefile | ||
mmcc-apq8084.c | ||
mmcc-msm8960.c | ||
mmcc-msm8974.c | ||
mmcc-msm8996.c | ||
reset.c | ||
reset.h |