Skip to content

Commit d6e5794

Browse files
t-8chPaolo Abeni
authored andcommitted
net: avoid build bug in skb extension length calculation
GCC seems to incorrectly fail to evaluate skb_ext_total_length() at compile time under certain conditions. The issue even occurs if all values in skb_ext_type_len[] are "0", ruling out the possibility of an actual overflow. As the patch has been in mainline since v6.6 without triggering the problem it seems to be a very uncommon occurrence. As the issue only occurs when -fno-tree-loop-im is specified as part of CFLAGS_GCOV, disable the BUILD_BUG_ON() only when building with coverage reporting enabled. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Suggested-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/lkml/[email protected]/ Fixes: 5d21d0a ("net: generalize calculation of skb extensions length") Cc: <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 7cb8cd4 commit d6e5794

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/core/skbuff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,7 +4825,9 @@ static __always_inline unsigned int skb_ext_total_length(void)
48254825
static void skb_extensions_init(void)
48264826
{
48274827
BUILD_BUG_ON(SKB_EXT_NUM >= 8);
4828+
#if !IS_ENABLED(CONFIG_KCOV_INSTRUMENT_ALL)
48284829
BUILD_BUG_ON(skb_ext_total_length() > 255);
4830+
#endif
48294831

48304832
skbuff_ext_cache = kmem_cache_create("skbuff_ext_cache",
48314833
SKB_EXT_ALIGN_VALUE * skb_ext_total_length(),

0 commit comments

Comments
 (0)