linux/drivers/i2c/muxes
Kees Cook 86f8a1ef96 i2c: mux: demux-pinctrl: Annotate struct i2c_demux_pinctrl_priv with __counted_by
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 i2c_demux_pinctrl_priv.
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

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
[wsa: improved blank lines]
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-09-24 22:49:13 +02:00
..
i2c-arb-gpio-challenge.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
i2c-demux-pinctrl.c i2c: mux: demux-pinctrl: Annotate struct i2c_demux_pinctrl_priv with __counted_by 2023-09-24 22:49:13 +02:00
i2c-mux-gpio.c i2c: mux: gpio: adhere to coding style 2023-09-22 11:58:18 +02:00
i2c-mux-gpmux.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-mux-ltc4306.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-mux-mlxcpld.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
i2c-mux-pca954x.c i2c: muxes: pca954x: Add regulator support 2023-08-23 23:09:12 +02:00
i2c-mux-pca9541.c i2c: mux: Convert all drivers to new .probe() callback 2023-03-09 21:59:18 +01:00
i2c-mux-pinctrl.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
i2c-mux-reg.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
Kconfig i2c: muxes: pca954x: Add MAX735x/MAX736x support 2023-08-23 23:09:03 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00