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@xxxxxxxxxxxx> > Cc: Stephen Boyd <sboyd@xxxxxxxxxx> > Cc: Joel Stanley <joel@xxxxxxxxx> > Cc: Andrew Jeffery <andrew@xxxxxxxx> > Cc: Taichi Sugaya <sugaya.taichi@xxxxxxxxxxxxx> > Cc: Takao Orito <orito.takao@xxxxxxxxxxxxx> > Cc: Qin Jian <qinjian@xxxxxxxxxxx> > Cc: Andrew Lunn <andrew@xxxxxxx> > Cc: Gregory Clement <gregory.clement@xxxxxxxxxxx> > Cc: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx> > Cc: Andy Gross <agross@xxxxxxxxxx> > Cc: Bjorn Andersson <andersson@xxxxxxxxxx> > Cc: Konrad Dybcio <konrad.dybcio@xxxxxxxxxx> > Cc: Sergio Paracuellos <sergio.paracuellos@xxxxxxxxx> > Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx> > Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx> > Cc: Maxime Ripard <mripard@xxxxxxxxxx> > Cc: Chen-Yu Tsai <wens@xxxxxxxx> > Cc: Jernej Skrabec <jernej.skrabec@xxxxxxxxx> > Cc: David Airlie <airlied@xxxxxxxxx> > Cc: Daniel Vetter <daniel@xxxxxxxx> > Cc: Samuel Holland <samuel@xxxxxxxxxxxx> > Cc: Vinod Koul <vkoul@xxxxxxxxxx> > Cc: Kishon Vijay Abraham I <kishon@xxxxxxxxxx> > Cc: linux-clk@xxxxxxxxxxxxxxx > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > Cc: linux-aspeed@xxxxxxxxxxxxxxxx > Cc: linux-arm-msm@xxxxxxxxxxxxxxx > Cc: linux-mediatek@xxxxxxxxxxxxxxxxxxx > Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx > Cc: linux-sunxi@xxxxxxxxxxxxxxx > Cc: linux-phy@xxxxxxxxxxxxxxxxxxx > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx> > --- Applied to clk-next