From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Date: Tue, 22 Aug 2023 14:00:34 -0700 Subject: [PATCH] clk: Annotate struct clk_hw_onecell_data with __counted_by In-Reply-To: <20230817203019.never.795-kees@kernel.org> References: <20230817203019.never.795-kees@kernel.org> Message-ID: List-Id: To: linux-aspeed@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 > Cc: Stephen Boyd > Cc: Joel Stanley > Cc: Andrew Jeffery > Cc: Taichi Sugaya > Cc: Takao Orito > Cc: Qin Jian > Cc: Andrew Lunn > Cc: Gregory Clement > Cc: Sebastian Hesselbarth > Cc: Andy Gross > Cc: Bjorn Andersson > Cc: Konrad Dybcio > Cc: Sergio Paracuellos > Cc: Matthias Brugger > Cc: AngeloGioacchino Del Regno > Cc: Maxime Ripard > Cc: Chen-Yu Tsai > Cc: Jernej Skrabec > Cc: David Airlie > Cc: Daniel Vetter > Cc: Samuel Holland > Cc: Vinod Koul > Cc: Kishon Vijay Abraham I > 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 > --- Applied to clk-next