]> www.infradead.org Git - users/jedix/linux-maple.git/commit
wifi: rtw89: coex: add annotation __counted_by() for struct rtw89_btc_btf_set_slot_table
authorPing-Ke Shih <pkshih@realtek.com>
Wed, 11 Oct 2023 06:37:24 +0000 (14:37 +0800)
committerKalle Valo <kvalo@kernel.org>
Thu, 12 Oct 2023 12:16:35 +0000 (15:16 +0300)
commit07202dc12b5373a9488a81a1a256582eec701aaf
tree3af9fa1939043b432a7ff3ace8f5cb342547301d
parentf1f74dffdfb74e3c70ffc7d9b434e39d6d01a31d
wifi: rtw89: coex: add annotation __counted_by() for struct rtw89_btc_btf_set_slot_table

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).

Use struct_size() and flex_array_size() helpers to calculate proper sizes
for allocation and memcpy().

Don't change logic at all, and result is identical as before.

Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20231011063725.25276-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/coex.c