On Monday 23 November 2015 23:52:58 Amitoj Kaur Chawla wrote:
> 32 bit systems using 'struct timeval' will break in the year 2038, so
> we modify the code appropriately.
> 
> This patch replaces the use of struct timeval and do_gettimeofday()
> with ktime_get_real_seconds() which returns a 64 bit value which is
> safer than struct timeval.
> 
> Signed-off-by: Amitoj Kaur Chawla <[email protected]>

The comment doesn't match what the patch does:

> diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
> index 6521896..0240554 100644
> --- a/drivers/scsi/bfa/bfa_svc.c
> +++ b/drivers/scsi/bfa/bfa_svc.c
> @@ -3424,13 +3424,10 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t 
> complete)
>         struct list_head *qe, *qen;
>  
>         if (complete) {
> -               struct timeval tv;
> -
>                 /*
>                  * re-initialize time stamp for stats reset
>                  */
> -               do_gettimeofday(&tv);
> -               fcport->stats_reset_time = tv.tv_sec;
> +               fcport->stats_reset_time = ktime_get_seconds();
>                 list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) {
>                         bfa_q_deq(&fcport->statsclr_pending_q, &qe);
>                         cb = (struct bfa_cb_pending_q_s *)qe;

You use ktime_get_seconds() rather than ktime_get_real_seconds(), and you don't
store the result in a 64-bit variable, so the range extension doesn't work.
This is ok if all uses of the variable are changed to monotonic time, but
in this case they are not:

From looking at the uses of stats_reset_time, it seems that you need to change
__bfa_cb_fcport_stats_get at the same time.

        Arnd
_______________________________________________
Y2038 mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/y2038

Reply via email to