Re: [Y2038] [PATCH] xen/pcifront: Remove usage of struct timeval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 11 May 2015 08:14:48 Tina Ruchandani wrote:
> struct timeval uses a 32-bit field for representing seconds,
> which will overflow in the year 2038 and beyond. This patch replaces
> struct timeval with 64-bit ktime_t which is 2038 safe.
> The patch is part of a larger effort to remove instances of
> 32-bit timekeeping variables (timeval, time_t and timespec)
> from the kernel.

The patch looks correct to me, just two minor points:

> +       tv = ktime_get_real();
> +       ns_timeout = ktime_to_ns(tv) + 2 * (s64)NSEC_PER_SEC;

* We have a macro for doing this in one line, so you can just use

	ns_timeout = ktime_get_real_ns() + 2 * (s64)NSEC_PER_SEC;

* As the time is not stored anywhere and only used in a local function,
  using monotonic time instead of real time would slightly more appropriate,
  the only difference being the handling of a concurrent settimeofday()
  system call. That means calling ktime_get_ns() instead of ktime_get_real_ns().

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux