clk: tegra: annotate struct tegra210_clk_emc_provider with __counted_by_ptr
Subsystems (2)
PATCH 1/1 clk: tegra: annotate struct tegra210_clk_emc_provider with __counted_by_ptr
Annotate the "configs" pointer field of "struct tegra210_clk_emc_provider" with the "__counted_by_ptr" attribute, allowing the compiler to perform runtime bounds checking on accesses to "configs" based on the value of "num_configs".
The "emc->provider.configs = devm_kcalloc(...)" call uses "emc->num_timings" for the number of elements, which is then assigned to "emc->provider.num_configs" before any accesses to "configs". The "num_configs" field isn't modified after assignment.
--- include/linux/clk/tegra.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/clk/tegra.h +1 -1
@@ -170,7 +170,7 @@ struct tegra210_clk_emc_provider {struct module *owner;struct device *dev; -struct tegra210_clk_emc_config *configs; + struct tegra210_clk_emc_config *configs __counted_by_ptr(num_configs);unsigned int num_configs; int (*set_rate)(struct device *dev,
Signature · 1 line
2.55.0.1082.g2b9226bbc0-goog
Quoted 5 lines · Bill Wendling
Annotate the "configs" pointer field of "struct
tegra210_clk_emc_provider" with the "__counted_by_ptr" attribute, allowing the compiler to perform runtime bounds checking on accesses to "configs" based on the value of "num_configs".
Quoted 8 lines
The "
emc->provider.configs=devm_kcalloc(...)" call uses "emc->num_timings" for the number of elements, which is then assigned to "emc->provider.num_configs" before any accesses to "configs". The "num_configs" field isn't modified after assignment.
Thanks
-Gustavo
Quoted 17 lines
--- include/linux/clk/tegra.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/clk/tegra.h +1
-1@@ -170,7 +170,7 @@ struct tegra210_clk_emc_provider {struct module *owner;struct device *dev; -struct tegra210_clk_emc_config *configs; + struct tegra210_clk_emc_config *configs __counted_by_ptr(num_configs);unsigned int num_configs; int (*set_rate)(struct device *dev,
Quoted 9 lines · Bill Wendling
Annotate the "configs" pointer field of "struct
tegra210_clk_emc_provider" with the "__counted_by_ptr" attribute, allowing the compiler to perform runtime bounds checking on accesses to "configs" based on the value of "num_configs".The "
emc->provider.configs=devm_kcalloc(...)" call uses "emc->num_timings" for the number of elements, which is then assigned to "emc->provider.num_configs" before any accesses to "configs". The "num_configs" field isn't modified after assignment.
Yup, that's the only assignment I can find.
Quoted 3 lines
Signature · 1 line
Kees Cook
Brian Masney
AppliedQuoted 1 line · Bill Wendling
clk: tegra: annotate struct
tegra210_clk_emc_providerwith__counted_by_ptr
Applied, thanks!
[1/1] clk: tegra: annotate struct tegra210_clk_emc_provider with __counted_by_ptr
commit: a1f2029b89ccd7bef54e187384417db4d72d0a11
Best regards,
Signature · 1 line
Brian Masney <[email protected]>