[PATCH] mtd: rawnand: Annotate struct mtk_nfc_nand_chip with __counted_by

Miquel Raynal miquel.raynal at bootlin.com
Mon Oct 16 02:29:05 PDT 2023


On Fri, 2023-10-06 at 20:17:28 UTC, Kees Cook wrote:
> 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 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
> mtk_nfc_nand_chip.
> 
> Cc: Miquel Raynal <miquel.raynal at bootlin.com>
> Cc: Richard Weinberger <richard at nod.at>
> Cc: Vignesh Raghavendra <vigneshr at ti.com>
> Cc: Matthias Brugger <matthias.bgg at gmail.com>
> Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> Cc: "Gustavo A. R. Silva" <gustavoars at kernel.org>
> Cc: Heiko Stuebner <heiko at sntech.de>
> Cc: Martin Blumenstingl <martin.blumenstingl at googlemail.com>
> Cc: Thierry Reding <treding at nvidia.com>
> Cc: Roger Quadros <rogerq at kernel.org>
> Cc: "Uwe Kleine-König" <u.kleine-koenig at pengutronix.de>
> Cc: Cai Huoqing <cai.huoqing at linux.dev>
> Cc: Chuanhong Guo <gch981213 at gmail.com>
> Cc: Rob Herring <robh at kernel.org>
> Cc: Li Zetao <lizetao1 at huawei.com>
> Cc: linux-mtd at lists.infradead.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-mediatek at lists.infradead.org
> Cc: linux-hardening at vger.kernel.org
> Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1]
> Signed-off-by: Kees Cook <keescook at chromium.org>
> Reviewed-by: Gustavo A. R. Silva <gustavoars at kernel.org>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel



More information about the Linux-mediatek mailing list