]> www.infradead.org Git - users/jedix/linux-maple.git/commit
gpio: 74x164: Annotate buffer with __counted_by()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 7 Feb 2025 15:17:10 +0000 (17:17 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Tue, 11 Feb 2025 08:40:03 +0000 (09:40 +0100)
commitd746cc6e64027e331769f871a595a3dd2c6b30ff
tree8fc470c891e561e3d5cc0eb2fca529ef2ae2a6b5
parentbdd603acf6a2b5056dc174e52bc8b285da529dc4
gpio: 74x164: Annotate buffer with __counted_by()

Add the __counted_by() compiler attribute to the flexible array member
volumes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and
CONFIG_FORTIFY_SOURCE.

Use struct_size() instead of manually calculating the number of bytes to
allocate the private structure with a buffer.

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250207151825.2122419-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpio-74x164.c