[PATCH] clk: Annotate struct clk_hw_onecell_data with __counted_by

Stephen Boyd sboyd at kernel.org
Tue Aug 22 21:00:34 UTC 2023


Quoting Kees Cook (2023-08-17 13:30:22)
> Prepare for the coming implementation by GCC and Clang of the __counted_by
> attribute. Flexible array members annotated with __counted_by can have
> their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
> (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
> functions).
> 
> As found with Coccinelle[1], add __counted_by for struct clk_hw_onecell_data.
> Additionally, since the element count member must be set before accessing
> the annotated flexible array member, move its initialization earlier.
> 
> [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
> 
> Cc: Michael Turquette <mturquette at baylibre.com>
> Cc: Stephen Boyd <sboyd at kernel.org>
> Cc: Joel Stanley <joel at jms.id.au>
> Cc: Andrew Jeffery <andrew at aj.id.au>
> Cc: Taichi Sugaya <sugaya.taichi at socionext.com>
> Cc: Takao Orito <orito.takao at socionext.com>
> Cc: Qin Jian <qinjian at cqplus1.com>
> Cc: Andrew Lunn <andrew at lunn.ch>
> Cc: Gregory Clement <gregory.clement at bootlin.com>
> Cc: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
> Cc: Andy Gross <agross at kernel.org>
> Cc: Bjorn Andersson <andersson at kernel.org>
> Cc: Konrad Dybcio <konrad.dybcio at linaro.org>
> Cc: Sergio Paracuellos <sergio.paracuellos at gmail.com>
> Cc: Matthias Brugger <matthias.bgg at gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> Cc: Maxime Ripard <mripard at kernel.org>
> Cc: Chen-Yu Tsai <wens at csie.org>
> Cc: Jernej Skrabec <jernej.skrabec at gmail.com>
> Cc: David Airlie <airlied at gmail.com>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Samuel Holland <samuel at sholland.org>
> Cc: Vinod Koul <vkoul at kernel.org>
> Cc: Kishon Vijay Abraham I <kishon at kernel.org>
> Cc: linux-clk at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-aspeed at lists.ozlabs.org
> Cc: linux-arm-msm at vger.kernel.org
> Cc: linux-mediatek at lists.infradead.org
> Cc: dri-devel at lists.freedesktop.org
> Cc: linux-sunxi at lists.linux.dev
> Cc: linux-phy at lists.infradead.org
> Signed-off-by: Kees Cook <keescook at chromium.org>
> ---

Applied to clk-next


More information about the dri-devel mailing list