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>
This commit is contained in:
parent
8ddbb3124d
commit
9f138fa609
|
@ -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 */
|
/* We assume all kernel code knows the size of sockaddr_storage */
|
||||||
msg.msg_namelen = 0;
|
msg.msg_namelen = 0;
|
||||||
msg.msg_iocb = NULL;
|
msg.msg_iocb = NULL;
|
||||||
|
msg.msg_flags = 0;
|
||||||
if (sock->file->f_flags & O_NONBLOCK)
|
if (sock->file->f_flags & O_NONBLOCK)
|
||||||
flags |= MSG_DONTWAIT;
|
flags |= MSG_DONTWAIT;
|
||||||
err = sock_recvmsg(sock, &msg, flags);
|
err = sock_recvmsg(sock, &msg, flags);
|
||||||
|
|
Loading…
Reference in New Issue