public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
@ 2018-04-09  8:31 Florian Weimer
  2018-04-09  9:02 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2018-04-09  8:31 UTC (permalink / raw)
  To: libc-alpha

2018-04-09  Florian Weimer  <fweimer@redhat.com>

	[BZ #23037]
	* resolv/res_send.c (send_dg): Use designated initializers instead
	of assignment to zero-initialize other fields of struct mmsghdr.

diff --git a/resolv/res_send.c b/resolv/res_send.c
index 7debf143f7..9e9541789b 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -1157,25 +1157,27 @@ send_dg(res_state statp,
 		if (have_sendmmsg >= 0 && nwritten == 0 && buf2 != NULL
 		    && !single_request)
 		  {
-		    struct iovec iov[2];
-		    struct mmsghdr reqs[2];
-		    reqs[0].msg_hdr.msg_name = NULL;
-		    reqs[0].msg_hdr.msg_namelen = 0;
-		    reqs[0].msg_hdr.msg_iov = &iov[0];
-		    reqs[0].msg_hdr.msg_iovlen = 1;
-		    iov[0].iov_base = (void *) buf;
-		    iov[0].iov_len = buflen;
-		    reqs[0].msg_hdr.msg_control = NULL;
-		    reqs[0].msg_hdr.msg_controllen = 0;
-
-		    reqs[1].msg_hdr.msg_name = NULL;
-		    reqs[1].msg_hdr.msg_namelen = 0;
-		    reqs[1].msg_hdr.msg_iov = &iov[1];
-		    reqs[1].msg_hdr.msg_iovlen = 1;
-		    iov[1].iov_base = (void *) buf2;
-		    iov[1].iov_len = buflen2;
-		    reqs[1].msg_hdr.msg_control = NULL;
-		    reqs[1].msg_hdr.msg_controllen = 0;
+		    struct iovec iov =
+		      { .iov_base = (void *) buf, .iov_len = buflen };
+		    struct iovec iov2 =
+		      { .iov_base = (void *) buf2, .iov_len = buflen2 };
+		    struct mmsghdr reqs[2] =
+		      {
+			{
+			  .msg_hdr =
+			    {
+			      .msg_iov = &iov,
+			      .msg_iovlen = 1,
+			    },
+			},
+			{
+			  .msg_hdr =
+			    {
+			      .msg_iov = &iov2,
+			      .msg_iovlen = 1,
+			    }
+			},
+		      };
 
 		    int ndg = __sendmmsg (pfd[0].fd, reqs, 2, MSG_NOSIGNAL);
 		    if (__glibc_likely (ndg == 2))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
  2018-04-09  8:31 [PATCH COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037] Florian Weimer
@ 2018-04-09  9:02 ` Andreas Schwab
  2018-04-09  9:07   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2018-04-09  9:02 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

I think this has no real influence on the use in the resolver since the
socket it creates isn't a SOCK_SEQPACKET socket.  Do you agree?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037]
  2018-04-09  9:02 ` Andreas Schwab
@ 2018-04-09  9:07   ` Florian Weimer
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2018-04-09  9:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha

On 04/09/2018 11:02 AM, Andreas Schwab wrote:
> I think this has no real influence on the use in the resolver since the
> socket it creates isn't a SOCK_SEQPACKET socket.  Do you agree?

It doesn't make a difference today, but the kernel folks might add 
processing for further flags in the future.  Some of the existing MSG_* 
flag look relevant to UDP.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-09  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-09  8:31 [PATCH COMMITTED] resolv: Fully initialize struct mmsghdr in send_dg [BZ #23037] Florian Weimer
2018-04-09  9:02 ` Andreas Schwab
2018-04-09  9:07   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).