From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH 3/7] linux: Use the expected size for SO_TIMESTAMP{NS} convertion
Date: Mon, 05 Jul 2021 21:00:55 +0200 [thread overview]
Message-ID: <87pmvwk2l4.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20210705183027.3804093-4-adhemerval.zanella@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Mon, 5 Jul 2021 15:30:23 -0300")
* Adhemerval Zanella via Libc-alpha:
> Kernel returns 32-bit values for COMPAT_SO_TIMESTAMP{NS}_OLD,
> no 64-bit ones.
“not 64-bit values”?
> diff --git a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
> index 5af71847f5..2db5750f50 100644
> --- a/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
> +++ b/sysdeps/unix/sysv/linux/convert_scm_timestamps.c
> @@ -44,7 +44,8 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
> 'struct __kernel_sock_timeval' while for SO_TIMESTAMPNS_NEW is a
> 'struct __kernel_timespec'. In either case it is two uint64_t
> members. */
> - uint64_t tvts[2];
> + int64_t tvts[2];
> + int32_t tmp;
>
> struct cmsghdr *cmsg, *last = NULL;
> int type = 0;
> @@ -69,7 +70,10 @@ __convert_scm_timestamps (struct msghdr *msg, socklen_t msgsize)
>
> /* fallthrough */
> common:
> - memcpy (tvts, CMSG_DATA (cmsg), sizeof (tvts));
> + memcpy (&tmp, CMSG_DATA (cmsg), sizeof (tmp));
> + tvts[0] = tmp;
> + memcpy (&tmp, CMSG_DATA (cmsg) + sizeof (tmp), sizeof (tmp));
> + tvts[1] = tmp;
> break;
Maybe it's clearer to make tmp an array and use a single memcpy call?
Thanks,
Florian
next prev parent reply other threads:[~2021-07-05 19:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 18:30 [PATCH 0/7] Linux 64-bit time_t socket fixes Adhemerval Zanella
2021-07-05 18:30 ` [PATCH 1/7] linux: Consolidate Linux getsockopt implementation Adhemerval Zanella
2021-07-05 18:58 ` Florian Weimer
2021-07-05 18:30 ` [PATCH 2/7] linux: Consolidate Linux setsockopt implementation Adhemerval Zanella
2021-07-05 18:59 ` Florian Weimer
2021-07-05 18:30 ` [PATCH 3/7] linux: Use the expected size for SO_TIMESTAMP{NS} convertion Adhemerval Zanella
2021-07-05 19:00 ` Florian Weimer [this message]
2021-07-06 13:06 ` Adhemerval Zanella
2021-07-05 18:30 ` [PATCH 4/7] linux: Fix setsockopt fallback Adhemerval Zanella
2021-07-05 19:07 ` Florian Weimer
2021-07-06 13:07 ` Adhemerval Zanella
2021-07-06 14:08 ` Florian Weimer
2021-07-05 18:30 ` [PATCH 5/7] support: Add support_socket_time64_timestamp Adhemerval Zanella
2021-07-05 18:46 ` Florian Weimer
2021-07-05 18:51 ` Adhemerval Zanella
2021-07-05 18:30 ` [PATCH 6/7] socket: Add recvmsg timestamp test Adhemerval Zanella
2021-07-05 19:32 ` Florian Weimer
2021-07-05 19:51 ` Adhemerval Zanella
2021-07-05 20:02 ` Florian Weimer
2021-07-05 20:35 ` Adhemerval Zanella
2021-07-06 9:29 ` Florian Weimer
2021-07-06 12:55 ` Adhemerval Zanella
2021-07-06 14:50 ` Florian Weimer
2021-07-05 18:30 ` [PATCH 7/7] socket: Add recvmmsg " Adhemerval Zanella
2021-07-05 19:12 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmvwk2l4.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).