diff options
author | Kees Cook <keescook@chromium.org> | 2021-07-31 17:50:58 -0700 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2021-09-25 08:20:48 -0700 |
commit | c92a08c1afff1144b8dd8d87bdc4d68a7538987f (patch) | |
tree | 3f5b975bccfd896229ee6e6f453d554d37398fcf /drivers/char | |
parent | 69dae0fe1073944065fff0f7fe24cde6e150ee9d (diff) | |
download | linux-c92a08c1afff1144b8dd8d87bdc4d68a7538987f.tar.bz2 |
can: flexcan: Use struct_group() to zero struct flexcan_regs regions
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memset(), avoid intentionally writing across
neighboring fields.
Add struct_group() to mark both regions of struct flexcan_regs that get
initialized to zero. Avoid the future warnings:
In function 'fortify_memset_chk',
inlined from 'memset_io' at ./include/asm-generic/io.h:1169:2,
inlined from 'flexcan_ram_init' at drivers/net/can/flexcan.c:1403:2:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'fortify_memset_chk',
inlined from 'memset_io' at ./include/asm-generic/io.h:1169:2,
inlined from 'flexcan_ram_init' at drivers/net/can/flexcan.c:1408:3:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/char')
0 files changed, 0 insertions, 0 deletions