[PATCH] net: kmemcheck annotation in struct socket
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 15 Sep 2009 09:39:20 +0000 (02:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Sep 2009 09:39:20 +0000 (02:39 -0700)
struct socket has a 16 bit hole that triggers kmemcheck warnings.

As suggested by Ingo, use kmemcheck annotations

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/net.h
net/socket.c

index 4fc2ffd527f9386e613afe1e54a552268a491eb5..9040a10584f7fe0b11ae5012d42e3cf5bec9fcf2 100644 (file)
@@ -57,6 +57,7 @@ typedef enum {
 #include <linux/random.h>
 #include <linux/wait.h>
 #include <linux/fcntl.h>       /* For O_CLOEXEC and O_NONBLOCK */
+#include <linux/kmemcheck.h>
 
 struct poll_table_struct;
 struct pipe_inode_info;
@@ -127,7 +128,11 @@ enum sock_shutdown_cmd {
  */
 struct socket {
        socket_state            state;
+
+       kmemcheck_bitfield_begin(type);
        short                   type;
+       kmemcheck_bitfield_end(type);
+
        unsigned long           flags;
        /*
         * Please keep fasync_list & wait fields in the same cache line
index 6d47165590473daa4990bf69b0435d5c49b41302..2a022c00d85c509e2346a8afac33eaa63154439a 100644 (file)
@@ -489,6 +489,7 @@ static struct socket *sock_alloc(void)
 
        sock = SOCKET_I(inode);
 
+       kmemcheck_annotate_bitfield(sock, type);
        inode->i_mode = S_IFSOCK | S_IRWXUGO;
        inode->i_uid = current_fsuid();
        inode->i_gid = current_fsgid();