Initilize the msg_flags field consistently in all code paths.

Reported by:	Coverity
CID:		1018726
This commit is contained in:
Michael Tuexen 2014-12-17 07:47:25 +00:00
parent dde58752db
commit 2b8a4d8033
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275857

View File

@ -597,6 +597,7 @@ sctp_sendmsg(int s,
msg.msg_iovlen = 1;
msg.msg_control = cmsgbuf;
msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));
msg.msg_flags = 0;
cmsg = (struct cmsghdr *)cmsgbuf;
cmsg->cmsg_level = IPPROTO_SCTP;
cmsg->cmsg_type = SCTP_SNDRCV;
@ -663,6 +664,7 @@ sctp_send(int sd, const void *data, size_t len,
msg.msg_iovlen = 1;
msg.msg_control = cmsgbuf;
msg.msg_controllen = CMSG_SPACE(sizeof(struct sctp_sndrcvinfo));
msg.msg_flags = 0;
cmsg = (struct cmsghdr *)cmsgbuf;
cmsg->cmsg_level = IPPROTO_SCTP;
cmsg->cmsg_type = SCTP_SNDRCV;
@ -820,7 +822,6 @@ sctp_recvmsg(int s,
errno = EINVAL;
return (-1);
}
msg.msg_flags = 0;
iov.iov_base = dbuf;
iov.iov_len = len;
msg.msg_name = (caddr_t)from;
@ -832,6 +833,7 @@ sctp_recvmsg(int s,
msg.msg_iovlen = 1;
msg.msg_control = cmsgbuf;
msg.msg_controllen = sizeof(cmsgbuf);
msg.msg_flags = 0;
sz = recvmsg(s, &msg, *msg_flags);
*msg_flags = msg.msg_flags;
if (sz <= 0) {
@ -905,6 +907,7 @@ sctp_recvv(int sd,
msg.msg_iovlen = iovlen;
msg.msg_control = cmsgbuf;
msg.msg_controllen = sizeof(cmsgbuf);
msg.msg_flags = 0;
ret = recvmsg(sd, &msg, *flags);
*flags = msg.msg_flags;
if ((ret > 0) &&