summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-12-07 09:27:58 +0300
committerJakub Kicinski <kuba@kernel.org>2021-12-09 22:54:24 +0300
commit1a2fb220edca98d18f90e3ef5bd6853a6b22b1b8 (patch)
tree342a54a94b1767690899c205deff0e1f1ce38013 /net/core
parentf20f94f7f52c4685c81754f489ffcc72186e8bdb (diff)
downloadlinux-1a2fb220edca98d18f90e3ef5bd6853a6b22b1b8.tar.xz
skbuff: Extract list pointers to silence compiler warnings
Under both -Warray-bounds and the object_size sanitizer, the compiler is upset about accessing prev/next of sk_buff when the object it thinks it is coming from is sk_buff_head. The warning is a false positive due to the compiler taking a conservative approach, opting to warn at casting time rather than access time. However, in support of enabling -Warray-bounds globally (which has found many real bugs), arrange things for sk_buff so that the compiler can unambiguously see that there is no intention to access anything except prev/next. Introduce and cast to a separate struct sk_buff_list, which contains _only_ the first two fields, silencing the warnings: In file included from ./include/net/net_namespace.h:39, from ./include/linux/netdevice.h:37, from net/core/netpoll.c:17: net/core/netpoll.c: In function 'refill_skbs': ./include/linux/skbuff.h:2086:9: warning: array subscript 'struct sk_buff[0]' is partly outside array bounds of 'struct sk_buff_head[1]' [-Warray-bounds] 2086 | __skb_insert(newsk, next->prev, next, list); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/core/netpoll.c:49:28: note: while referencing 'skb_pool' 49 | static struct sk_buff_head skb_pool; | ^~~~~~~~ This change results in no executable instruction differences. Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20211207062758.2324338-1-keescook@chromium.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/core')
0 files changed, 0 insertions, 0 deletions