summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2022-08-02 19:12:03 +0300
committerJakub Kicinski <kuba@kernel.org>2022-08-06 05:34:54 +0300
commitac0dbed9ba4c38ed9b5fd3a43ee4bc1f48901a34 (patch)
treecd70c3700149490745480d5b15b856e22c90ce22 /net/wireless
parentbc3410f250219660a7be032c01c954a53b2c26ab (diff)
downloadlinux-ac0dbed9ba4c38ed9b5fd3a43ee4bc1f48901a34.tar.xz
net: seg6: initialize induction variable to first valid array index
Fixes the following warnings observed when building CONFIG_IPV6_SEG6_LWTUNNEL=y with clang: net/ipv6/seg6_local.o: warning: objtool: seg6_local_fill_encap() falls through to next function seg6_local_get_encap_size() net/ipv6/seg6_local.o: warning: objtool: seg6_local_cmp_encap() falls through to next function input_action_end() LLVM can fully unroll loops in seg6_local_get_encap_size() and seg6_local_cmp_encap(). One issue in those loops is that the induction variable is initialized to 0. The loop iterates over members of seg6_action_params, a global array of struct seg6_action_param calling their put() function pointer members. seg6_action_param uses an array initializer to initialize SEG6_LOCAL_SRH and later elements, which is the third enumeration of an anonymous union. The guard `if (attrs & SEG6_F_ATTR(i))` may prevent this from being called at runtime, but it would still be UB for `seg6_action_params[0]->put` to be called; the unrolled loop will make the initial iterations unreachable, which LLVM will later rotate to fallthrough to the next function. Make this more obvious that this cannot happen to the compiler by initializing the loop induction variable to the minimum valid index that seg6_action_params is initialized to. Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Link: https://lore.kernel.org/r/20220802161203.622293-1-ndesaulniers@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/wireless')
0 files changed, 0 insertions, 0 deletions