From: Alexander Potapenko Date: Wed, 8 Mar 2017 17:08:16 +0000 (+0100) Subject: net: initialize msg.msg_flags in recvfrom X-Git-Tag: microblaze-4.13-rc1~472^2~33 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=9f138fa609c47403374a862a08a41394be53d461;p=linux-2.6-microblaze.git 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 Signed-off-by: David S. Miller --- 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);