Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1595396
| From | Alexander Potapenko <glider@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] net: initialize msg.msg_flags in recvfrom |
| Date | 2017-03-08 18:20 +0100 |
| Message-ID | <tiNpM-1c7-21@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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> --- Changes since v1: - removed KMSAN report and reproducer from the description --- net/socket.c | 1 + 1 file changed, 1 insertion(+) 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); -- 2.12.0.246.ga2ecc84866-goog
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] net: initialize msg.msg_flags in recvfrom Alexander Potapenko <glider@google.com> - 2017-03-08 18:20 +0100 Re: [PATCH v2] net: initialize msg.msg_flags in recvfrom David Miller <davem@davemloft.net> - 2017-03-10 02:30 +0100
csiph-web