ipvs: ip_vs_fill_iph_skb: Silence warning that 'iph.thoff_reasm' may be used uninitialized
Subsystems (4)
PATCH 1/1 ipvs: ip_vs_fill_iph_skb: Silence warning that 'iph.thoff_reasm' may be used uninitialized
If CONFIG_IP_VS_IPV6 is not defined, then ip_vs_fill_iph_skb() does not initialize all of the fields in struct ip_vs_iphdr. Silence the 'may be used uninitialized' warning in the IPV4 only case by initializing the only field that is unique to IPV6.
net/netfilter/ipvs/ip_vs_pe_sip.c: In function 'ip_vs_sip_fill_param':net/netfilter/ipvs/ip_vs_pe_sip.c:87:11: warning: 'iph.thoff_reasm' may be used uninitialized in this function [-Wuninitialized]
gcc version 4.6.3
Also update comment to correctly reference fragoffs.
Cc Wensong Zhang <[email protected]>
Cc Simon Horman <[email protected]>
Cc Julian Anastasov <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Alexey Kuznetsov <[email protected]>
Cc James Morris <[email protected]>
Cc Hideaki YOSHIFUJI <[email protected]>
Cc Patrick McHardy <[email protected]>
Signed-off-by Tim Gardner <[email protected]>
--- include/net/ip_vs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/net/ip_vs.h +4 -2
@@ -165,14 +165,16 @@ ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) static inline void ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr) { + /* May not get initialized in all cases */ + iphdr->thoff_reasm = 0; + #ifdef CONFIG_IP_VS_IPV6 if (af == AF_INET6) { const struct ipv6hdr *iph = (struct ipv6hdr *)skb_network_header(skb); iphdr->saddr.in6 = iph->saddr; iphdr->daddr.in6 = iph->daddr; - /* ipv6_find_hdr() updates len, flags, thoff_reasm */ - iphdr->thoff_reasm = 0; + /* ipv6_find_hdr() updates len, flags, and fragoffs */ iphdr->len = 0; iphdr->flags = 0; iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
Signature · 1 line
1.7.9.5