From: Hannes Reinecke <hare@suse.de>
To: Tina Ruchandani <ruchandani.tina@gmail.com>,
linux-scsi@vger.kernel.org, arnd@arndb.de
Cc: y2038@lists.linaro.org,
"James E.J. Bottomley" <JBottomley@odin.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v3] scsi: stex: Remove use of struct timeval
Date: Fri, 30 Oct 2015 12:58:33 +0100 [thread overview]
Message-ID: <56335B69.4010502@suse.de> (raw)
In-Reply-To: <20151030083040.GA31741@tina-laptop>
On 10/30/2015 09:30 AM, Tina Ruchandani wrote:
> Function stex_gettime uses 'struct timeval' whose tv_sec value
> will overflow on 32-bit systems in year 2038 and beyond. This patch
> replaces the use of struct timeval and do_gettimeofday with
> ktime_get_real_seconds, which returns a 64-bit seconds value.
>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> --
> Changes in v3:
> - Remove stex_gettime altogether, directly assign the timestamp.
> Changes in v2:
> - Change subject line to indicate that the patch is restricted to stex driver.
> ---
> ---
> drivers/scsi/stex.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
> index 98a62bc..84e196e 100644
> --- a/drivers/scsi/stex.c
> +++ b/drivers/scsi/stex.c
> @@ -25,6 +25,7 @@
> #include <linux/types.h>
> #include <linux/module.h>
> #include <linux/spinlock.h>
> +#include <linux/ktime.h>
> #include <asm/io.h>
> #include <asm/irq.h>
> #include <asm/byteorder.h>
> @@ -362,14 +363,6 @@ MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers");
> MODULE_LICENSE("GPL");
> MODULE_VERSION(ST_DRIVER_VERSION);
>
> -static void stex_gettime(__le64 *time)
> -{
> - struct timeval tv;
> -
> - do_gettimeofday(&tv);
> - *time = cpu_to_le64(tv.tv_sec);
> -}
> -
> static struct status_msg *stex_get_status(struct st_hba *hba)
> {
> struct status_msg *status = hba->status_buffer + hba->status_tail;
> @@ -1002,7 +995,7 @@ static int stex_common_handshake(struct st_hba *hba)
> h->req_cnt = cpu_to_le16(hba->rq_count+1);
> h->status_sz = cpu_to_le16(sizeof(struct status_msg));
> h->status_cnt = cpu_to_le16(hba->sts_count+1);
> - stex_gettime(&h->hosttime);
> + h->hosttime = cpu_to_le64(ktime_get_real_seconds());
> h->partner_type = HMU_PARTNER_TYPE;
> if (hba->extra_offset) {
> h->extra_offset = cpu_to_le32(hba->extra_offset);
> @@ -1076,7 +1069,7 @@ static int stex_ss_handshake(struct st_hba *hba)
> h->req_cnt = cpu_to_le16(hba->rq_count+1);
> h->status_sz = cpu_to_le16(sizeof(struct status_msg));
> h->status_cnt = cpu_to_le16(hba->sts_count+1);
> - stex_gettime(&h->hosttime);
> + h->hosttime = cpu_to_le64(ktime_get_real_seconds());
> h->partner_type = HMU_PARTNER_TYPE;
> h->extra_offset = h->extra_size = 0;
> scratch_size = (hba->sts_count+1)*sizeof(u32);
>
Just remove 'hosttime' altogether. It serves no purpose whatsoever.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038
WARNING: multiple messages have this Message-ID (diff)
From: Hannes Reinecke <hare@suse.de>
To: Tina Ruchandani <ruchandani.tina@gmail.com>,
linux-scsi@vger.kernel.org, arnd@arndb.de
Cc: "James E.J. Bottomley" <JBottomley@odin.com>,
y2038@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v3] scsi: stex: Remove use of struct timeval
Date: Fri, 30 Oct 2015 12:58:33 +0100 [thread overview]
Message-ID: <56335B69.4010502@suse.de> (raw)
In-Reply-To: <20151030083040.GA31741@tina-laptop>
On 10/30/2015 09:30 AM, Tina Ruchandani wrote:
> Function stex_gettime uses 'struct timeval' whose tv_sec value
> will overflow on 32-bit systems in year 2038 and beyond. This patch
> replaces the use of struct timeval and do_gettimeofday with
> ktime_get_real_seconds, which returns a 64-bit seconds value.
>
> Suggested-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> --
> Changes in v3:
> - Remove stex_gettime altogether, directly assign the timestamp.
> Changes in v2:
> - Change subject line to indicate that the patch is restricted to stex driver.
> ---
> ---
> drivers/scsi/stex.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
> index 98a62bc..84e196e 100644
> --- a/drivers/scsi/stex.c
> +++ b/drivers/scsi/stex.c
> @@ -25,6 +25,7 @@
> #include <linux/types.h>
> #include <linux/module.h>
> #include <linux/spinlock.h>
> +#include <linux/ktime.h>
> #include <asm/io.h>
> #include <asm/irq.h>
> #include <asm/byteorder.h>
> @@ -362,14 +363,6 @@ MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers");
> MODULE_LICENSE("GPL");
> MODULE_VERSION(ST_DRIVER_VERSION);
>
> -static void stex_gettime(__le64 *time)
> -{
> - struct timeval tv;
> -
> - do_gettimeofday(&tv);
> - *time = cpu_to_le64(tv.tv_sec);
> -}
> -
> static struct status_msg *stex_get_status(struct st_hba *hba)
> {
> struct status_msg *status = hba->status_buffer + hba->status_tail;
> @@ -1002,7 +995,7 @@ static int stex_common_handshake(struct st_hba *hba)
> h->req_cnt = cpu_to_le16(hba->rq_count+1);
> h->status_sz = cpu_to_le16(sizeof(struct status_msg));
> h->status_cnt = cpu_to_le16(hba->sts_count+1);
> - stex_gettime(&h->hosttime);
> + h->hosttime = cpu_to_le64(ktime_get_real_seconds());
> h->partner_type = HMU_PARTNER_TYPE;
> if (hba->extra_offset) {
> h->extra_offset = cpu_to_le32(hba->extra_offset);
> @@ -1076,7 +1069,7 @@ static int stex_ss_handshake(struct st_hba *hba)
> h->req_cnt = cpu_to_le16(hba->rq_count+1);
> h->status_sz = cpu_to_le16(sizeof(struct status_msg));
> h->status_cnt = cpu_to_le16(hba->sts_count+1);
> - stex_gettime(&h->hosttime);
> + h->hosttime = cpu_to_le64(ktime_get_real_seconds());
> h->partner_type = HMU_PARTNER_TYPE;
> h->extra_offset = h->extra_size = 0;
> scratch_size = (hba->sts_count+1)*sizeof(u32);
>
Just remove 'hosttime' altogether. It serves no purpose whatsoever.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
next prev parent reply other threads:[~2015-10-30 11:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-30 8:30 [RESEND PATCH v3] scsi: stex: Remove use of struct timeval Tina Ruchandani
2015-10-30 8:30 ` Tina Ruchandani
2015-10-30 8:50 ` Johannes Thumshirn
2015-10-30 8:50 ` Johannes Thumshirn
2015-10-30 8:54 ` Tina Ruchandani
2015-10-30 23:37 ` [Y2038] " Arnd Bergmann
2015-10-30 11:58 ` Hannes Reinecke [this message]
2015-10-30 11:58 ` Hannes Reinecke
2015-10-30 12:45 ` Arnd Bergmann
2015-11-02 7:49 ` Hannes Reinecke
2015-11-05 16:23 ` [Y2038] " Arnd Bergmann
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=56335B69.4010502@suse.de \
--to=hare@suse.de \
--cc=JBottomley@odin.com \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=ruchandani.tina@gmail.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.