All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: outreachy-kernel@googlegroups.com, JBottomley@odin.com,
	Alison Schofield <amsfield22@gmail.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3] scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()
Date: Mon, 09 Nov 2015 21:33:29 +0100	[thread overview]
Message-ID: <4181408.ziShjq4Q0D@wuerfel> (raw)
In-Reply-To: <1447097660-3063-1-git-send-email-amsfield22@gmail.com>

On Monday 09 November 2015 11:34:20 Alison Schofield wrote:
> Replace the use of struct timeval and do_gettimeofday() with
> 64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
> in year 2038 on 32-bit systems.
> 
> Driver was using the seconds portion of struct timeval (.tv_secs)
> to pass a millseconds timestamp to the firmware. This change maintains
> that same behavior using ktime_get_real_seconds.
> 
> The structure used to pass the timestamp to firmware is 48 bits and
> works fine as long as the top 16 bits are zero and they will be zero
> for a long time..ie. thousands of years.
> 
> Alternative Change:  Add sub second granularity to timestamp
> 
> As noted above, the driver only used the seconds portion of timeval,
> ignores the microseconds portion, and by multiplying by 1000 effectively
> does a <<10 and always writes zero into timestamp[0].
> 
> The alternative change would pass all the bits to the firmware:
> 
>         struct timespec64 ts;
> 
>         ktime_get_real_ts64(&ts);
>         timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
> 
> MAINTAINER: Please request alternate change if preferred.
> 
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> 

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

just the last sentence of the changelog should probably go below the
"---" line as it is irrelevant in the git history if the patch gets
applied. James can probably remove that line manually when he applies
it, just remember this if you have to send a version 4 for another
reason.

	Arnd
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Alison Schofield <amsfield22@gmail.com>,
	JBottomley@odin.com, outreachy-kernel@googlegroups.com,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [Y2038] [PATCH v3] scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()
Date: Mon, 09 Nov 2015 21:33:29 +0100	[thread overview]
Message-ID: <4181408.ziShjq4Q0D@wuerfel> (raw)
In-Reply-To: <1447097660-3063-1-git-send-email-amsfield22@gmail.com>

On Monday 09 November 2015 11:34:20 Alison Schofield wrote:
> Replace the use of struct timeval and do_gettimeofday() with
> 64 bit ktime_get_real_seconds. Prevents 32-bit type overflow
> in year 2038 on 32-bit systems.
> 
> Driver was using the seconds portion of struct timeval (.tv_secs)
> to pass a millseconds timestamp to the firmware. This change maintains
> that same behavior using ktime_get_real_seconds.
> 
> The structure used to pass the timestamp to firmware is 48 bits and
> works fine as long as the top 16 bits are zero and they will be zero
> for a long time..ie. thousands of years.
> 
> Alternative Change:  Add sub second granularity to timestamp
> 
> As noted above, the driver only used the seconds portion of timeval,
> ignores the microseconds portion, and by multiplying by 1000 effectively
> does a <<10 and always writes zero into timestamp[0].
> 
> The alternative change would pass all the bits to the firmware:
> 
>         struct timespec64 ts;
> 
>         ktime_get_real_ts64(&ts);
>         timestamp = ts.tv_sec * MSEC_PER_SEC + ts.tv_nsec / NSEC_PER_MSEC;
> 
> MAINTAINER: Please request alternate change if preferred.
> 
> Signed-off-by: Alison Schofield <amsfield22@gmail.com>
> 

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

just the last sentence of the changelog should probably go below the
"---" line as it is irrelevant in the git history if the patch gets
applied. James can probably remove that line manually when he applies
it, just remember this if you have to send a version 4 for another
reason.

	Arnd


  reply	other threads:[~2015-11-09 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 19:34 [PATCH v3] scsi: pmcraid: replace struct timeval with ktime_get_real_seconds() Alison Schofield
2015-11-09 20:33 ` Arnd Bergmann [this message]
2015-11-09 20:33   ` [Y2038] " Arnd Bergmann
2015-11-12  1:54 ` Martin K. Petersen
2015-11-12  1:54   ` Martin K. Petersen

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=4181408.ziShjq4Q0D@wuerfel \
    --to=arnd@arndb.de \
    --cc=JBottomley@odin.com \
    --cc=amsfield22@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=y2038@lists.linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.