summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2017-03-08 18:08:16 +0100
committerDavid S. Miller <davem@davemloft.net>2017-03-09 17:21:21 -0800
commit9f138fa609c47403374a862a08a41394be53d461 (patch)
tree4f70381934fe8a919b2b60d180dda52ae353ffa0 /net
parent8ddbb3124da9b1ea73567374ff01de5f62a6637b (diff)
net: initialize msg.msg_flags in recvfrom
KMSAN reports a use of uninitialized memory in put_cmsg() because msg.msg_flags in recvfrom haven't been initialized properly. The flag values don't affect the result on this path, but it's still a good idea to initialize them explicitly. Signed-off-by: Alexander Potapenko <glider@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 2c1e8677ff2d..e0757e648c0c 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1731,6 +1731,7 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size,
/* We assume all kernel code knows the size of sockaddr_storage */
msg.msg_namelen = 0;
msg.msg_iocb = NULL;
+ msg.msg_flags = 0;
if (sock->file->f_flags & O_NONBLOCK)
flags |= MSG_DONTWAIT;
err = sock_recvmsg(sock, &msg, flags);