Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: mmp: Annotate struct mmphw_ctrl 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 mmphw_ctrl.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Kees Cook and committed by
Helge Deller
053d7dcd ce9ecca0

+1 -1
+1 -1
drivers/video/fbdev/mmp/hw/mmp_ctrl.h
··· 1406 1406 1407 1407 /*pathes*/ 1408 1408 int path_num; 1409 - struct mmphw_path_plat path_plats[]; 1409 + struct mmphw_path_plat path_plats[] __counted_by(path_num); 1410 1410 }; 1411 1411 1412 1412 static inline int overlay_is_vid(struct mmp_overlay *overlay)