linux/net/bridge/netfilter
GONG, Ruiqi a7ed3465da netfilter: ebtables: fix fortify warnings in size_entry_mwt()
When compiling with gcc 13 and CONFIG_FORTIFY_SOURCE=y, the following
warning appears:

In function ‘fortify_memcpy_chk’,
    inlined from ‘size_entry_mwt’ at net/bridge/netfilter/ebtables.c:2118:2:
./include/linux/fortify-string.h:592:25: error: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Werror=attribute-warning]
  592 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The compiler is complaining:

memcpy(&offsets[1], &entry->watchers_offset,
                       sizeof(offsets) - sizeof(offsets[0]));

where memcpy reads beyong &entry->watchers_offset to copy
{watchers,target,next}_offset altogether into offsets[]. Silence the
warning by wrapping these three up via struct_group().

Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
2023-08-22 15:13:20 +02:00
..
ebt_802_3.c
ebt_among.c
ebt_arp.c
ebt_arpreply.c
ebt_dnat.c
ebt_ip6.c
ebt_ip.c
ebt_limit.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_log.c
ebt_mark_m.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_mark.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ebt_nflog.c
ebt_pkttype.c
ebt_redirect.c
ebt_snat.c
ebt_stp.c
ebt_vlan.c
ebtable_broute.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtable_filter.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtable_nat.c netfilter: ebtables: reject blobs that don't provide all entry points 2022-08-23 18:23:15 +02:00
ebtables.c netfilter: ebtables: fix fortify warnings in size_entry_mwt() 2023-08-22 15:13:20 +02:00
Kconfig netfilter: nf_log_bridge: merge with nf_log_syslog 2021-03-31 22:34:05 +02:00
Makefile netfilter: nf_log_bridge: merge with nf_log_syslog 2021-03-31 22:34:05 +02:00
nf_conntrack_bridge.c bridge: use skb_ip_totlen in br netfilter 2023-02-01 20:54:27 -08:00
nft_meta_bridge.c netfilter: bridge: introduce broute meta statement 2023-03-08 14:21:18 +01:00
nft_reject_bridge.c netfilter: nf_tables: do not reduce read-only expressions 2022-03-20 00:29:46 +01:00