From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH v2] Linux: Fix UTC offset setting in settimeofday for __TIMESIZE != 64
Date: Tue, 30 Jun 2020 16:12:56 -0300 [thread overview]
Message-ID: <90a41734-07bf-beb6-13c1-2024f0b1cc9e@linaro.org> (raw)
In-Reply-To: <87lfk4mlz6.fsf@oldenburg2.str.redhat.com>
On 30/06/2020 15:45, Florian Weimer wrote:
> The time argument is NULL in this case, and attempt to convert it
> leads to a null pointer dereference.
>
> This fixes commit d2e3b697da2433c08702f95c76458c51545c3df1
> ("y2038: linux: Provide __settimeofday64 implementation").
LGTM, thanks.
Reviwed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> ---
> v2: Add just a null pointer check. Tested on x86_64-linux-gnu and
> i686-linux-gnu.
>
> sysdeps/unix/sysv/linux/settimeofday.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/settimeofday.c b/sysdeps/unix/sysv/linux/settimeofday.c
> index ea45f1d7cb..6f4bc7ef3c 100644
> --- a/sysdeps/unix/sysv/linux/settimeofday.c
> +++ b/sysdeps/unix/sysv/linux/settimeofday.c
> @@ -25,6 +25,7 @@
> int
> __settimeofday64 (const struct __timeval64 *tv, const struct timezone *tz)
> {
> + /* Backwards compatibility for setting the UTC offset. */
> if (__glibc_unlikely (tz != 0))
> {
> if (tv != 0)
> @@ -45,9 +46,13 @@ libc_hidden_def (__settimeofday64)
> int
> __settimeofday (const struct timeval *tv, const struct timezone *tz)
> {
> - struct __timeval64 tv64 = valid_timeval_to_timeval64 (*tv);
> -
> - return __settimeofday64 (&tv64, tz);
> + if (__glibc_unlikely (tv == NULL))
> + return __settimeofday64 (NULL, tz);
Indentation seems off here.
> + else
> + {
> + struct __timeval64 tv64 = valid_timeval_to_timeval64 (*tv);
> + return __settimeofday64 (&tv64, tz);
> + }
> }
> #endif
> weak_alias (__settimeofday, settimeofday);
>
next prev parent reply other threads:[~2020-06-30 19:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-30 18:45 Florian Weimer
2020-06-30 19:12 ` Adhemerval Zanella [this message]
2020-06-30 19:19 ` Florian Weimer
2020-06-30 21:07 ` Alistair Francis
2020-07-01 0:06 ` Lukasz Majewski
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=90a41734-07bf-beb6-13c1-2024f0b1cc9e@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=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).