Commit 9e337b0fb3baa3c22490365b1bdee6f4741413d4

Authored by Vegard Nossum
1 parent 96c25c81ec

net: annotate inet_timewait_sock bitfields

The use of bitfields here would lead to false positive warnings with
kmemcheck. Silence them.

(Additionally, one erroneous comment related to the bitfield was also
fixed.)

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

include/net/inet_timewait_sock.h
... ... @@ -16,6 +16,7 @@
16 16 #define _INET_TIMEWAIT_SOCK_
17 17  
18 18  
  19 +#include <linux/kmemcheck.h>
19 20 #include <linux/list.h>
20 21 #include <linux/module.h>
21 22 #include <linux/timer.h>
22 23  
... ... @@ -127,10 +128,12 @@
127 128 __be32 tw_rcv_saddr;
128 129 __be16 tw_dport;
129 130 __u16 tw_num;
  131 + kmemcheck_bitfield_begin(flags);
130 132 /* And these are ours. */
131 133 __u8 tw_ipv6only:1,
132 134 tw_transparent:1;
133   - /* 15 bits hole, try to pack */
  135 + /* 14 bits hole, try to pack */
  136 + kmemcheck_bitfield_end(flags);
134 137 __u16 tw_ipv6_offset;
135 138 unsigned long tw_ttd;
136 139 struct inet_bind_bucket *tw_tb;
net/ipv4/inet_timewait_sock.c
... ... @@ -9,6 +9,7 @@
9 9 */
10 10  
11 11 #include <linux/kernel.h>
  12 +#include <linux/kmemcheck.h>
12 13 #include <net/inet_hashtables.h>
13 14 #include <net/inet_timewait_sock.h>
14 15 #include <net/ip.h>
... ... @@ -116,6 +117,8 @@
116 117 GFP_ATOMIC);
117 118 if (tw != NULL) {
118 119 const struct inet_sock *inet = inet_sk(sk);
  120 +
  121 + kmemcheck_annotate_bitfield(tw, flags);
119 122  
120 123 /* Give us an identity. */
121 124 tw->tw_daddr = inet->daddr;