Skip to content

Commit 29a020d

Browse files
Eric Dumazetdavem330
authored andcommitted
[PATCH] net: kmemcheck annotation in struct socket
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>
1 parent 75c7850 commit 29a020d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

include/linux/net.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ typedef enum {
5757
#include <linux/random.h>
5858
#include <linux/wait.h>
5959
#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
60+
#include <linux/kmemcheck.h>
6061

6162
struct poll_table_struct;
6263
struct pipe_inode_info;
@@ -127,7 +128,11 @@ enum sock_shutdown_cmd {
127128
*/
128129
struct socket {
129130
socket_state state;
131+
132+
kmemcheck_bitfield_begin(type);
130133
short type;
134+
kmemcheck_bitfield_end(type);
135+
131136
unsigned long flags;
132137
/*
133138
* Please keep fasync_list & wait fields in the same cache line

net/socket.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ static struct socket *sock_alloc(void)
489489

490490
sock = SOCKET_I(inode);
491491

492+
kmemcheck_annotate_bitfield(sock, type);
492493
inode->i_mode = S_IFSOCK | S_IRWXUGO;
493494
inode->i_uid = current_fsuid();
494495
inode->i_gid = current_fsgid();

0 commit comments

Comments
 (0)