Re: [PATCH] clk: tegra: annotate struct tegra210_clk_emc_provider with __counted_by_ptr

From: Kees Cook

Date: Wed Sep 23 2026 - 03:36:34 EST


On Tue, Sep 22, 2026 at 11:06:01AM +0000, Bill Wendling wrote:
> 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.

> Cc: codemender-patching+linux@xxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx>

Reviewed-by: Kees Cook <kees@xxxxxxxxxx>

--
Kees Cook