Re: [Y2038] [PATCH v2] prism54: isl_38xx: Replace 'struct timeval'

From: Arnd Bergmann
Date: Wed Mar 23 2016 - 09:28:29 EST


On Tuesday 22 March 2016 15:16:15 Tina Ruchandani wrote:
> 'struct timeval' uses a 32-bit seconds field which will overflow in
> year 2038 and beyond. This patch is part of a larger effort to remove
> all instances of 'struct timeval' from the kernel and replace them
> with 64-bit timekeeping variables.
> The correctness of the code isn't affected by this patch - the seconds
> value being printed would earlier be wrong due to overflow in timeval,
> and now it gets truncated to 32-bit due to the 'long' cast used on
> tv.sec field to prevent compiler warnings. Truly fixing this would
> require changing the debug print to print more than 8 digits and
> use a different specifier from %li.
> The patch was build-tested / debugged by removing the
> "if VERBOSE > SHOW_ERROR_MESSAGES" guards.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@xxxxxxxxx>
> Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> --
> Changes in v2:
> - Changed printf specifier as suggested by Arnd Bergmann to
> avoid truncation.
>

The patch looks great now, but it no longer matches the description,
as you actually fix the correctness.

Arnd