lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 4 Jun 2018 17:42:02 +0800
From:   Baolin Wang <baolin.wang@...aro.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Mark Brown <broonie@...nel.org>, linux-iio@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] iio: Convert to use timespec64 variables to get a time stamp

Hi Arnd,

On 4 June 2018 at 17:17, Arnd Bergmann <arnd@...db.de> wrote:
> On Mon, Jun 4, 2018 at 11:07 AM, Baolin Wang <baolin.wang@...aro.org> wrote:
>> The struct timespec is not y2038 safe on 32bit machines, thus this patch
>> converts to use timespec64 variables and related APIs to get a time stamp
>> for events etc.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
>
> Hi Baolin,
>
> I was waiting with this for the new header file cleanup to land. Thomas
> merged that one recently, so now we should be able to do this more nicely:

Thanks to point this out. Yes, let's use your nice patch.

>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 19bdf3d2962a..fcbe92c34a3d 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -207,35 +207,27 @@ static int iio_device_set_clock(struct iio_dev
> *indio_dev, clockid_t clock_id)
>   */
>  s64 iio_get_time_ns(const struct iio_dev *indio_dev)
>  {
> -       struct timespec tp;
> +       struct timespec64 tp;
>
>         switch (iio_device_get_clock(indio_dev)) {
>         case CLOCK_REALTIME:
> -               ktime_get_real_ts(&tp);
> -               break;
> +               return ktime_get_real_ns();
>         case CLOCK_MONOTONIC:
> -               ktime_get_ts(&tp);
> -               break;
> +               return ktime_get_ns();
>         case CLOCK_MONOTONIC_RAW:
> -               getrawmonotonic(&tp);
> -               break;
> +               return ktime_get_raw_ns();
>         case CLOCK_REALTIME_COARSE:
> -               tp = current_kernel_time();
> -               break;
> +               return ktime_to_ns(ktime_get_coarse_real());
>         case CLOCK_MONOTONIC_COARSE:
> -               tp = get_monotonic_coarse();
> -               break;
> +               ktime_get_coarse_ts64(&tp);
> +               return timespec64_to_ns(&tp);
>         case CLOCK_BOOTTIME:
> -               get_monotonic_boottime(&tp);
> -               break;
> +               return ktime_get_boot_ns();
>         case CLOCK_TAI:
> -               timekeeping_clocktai(&tp);
> -               break;
> +               return ktime_get_tai_ns();
>         default:
>                 BUG();
>         }
> -
> -       return timespec_to_ns(&tp);
>  }
>  EXPORT_SYMBOL(iio_get_time_ns);



-- 
Baolin.wang
Best Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ