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. Cc: [email protected] Assisted-by: LLM Signed-off-by: Bill Wendling <[email protected]> --- include/linux/clk/tegra.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index 3650e926e93f..f1034e14c1a4 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h @@ -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, -- 2.55.0.1082.g2b9226bbc0-goog

