From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
outreachy-kernel@googlegroups.com
Subject: Re: [Y2038] [PATCH] scsi: bfa: Remove struct timeval
Date: Wed, 04 Nov 2015 00:43:49 +0100 [thread overview]
Message-ID: <5910087.jVgJraTBut@wuerfel> (raw)
In-Reply-To: <20151101134346.GA8108@amitoj-Inspiron-3542>
On Sunday 01 November 2015 19:13:46 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 seconds value.
>
> This patch also replaces u32 timestamp with u64 timestamp in
> bfi_ioc_ctrl_req_s structure to store the 64 bit seconds value
> returned by ktime_get_real_seconds()
>
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> ---
This one is also wrong, but for other reasons as the earlier
patches:
> @@ -1808,13 +1809,11 @@ static void
> bfa_ioc_send_enable(struct bfa_ioc_s *ioc)
> {
> struct bfi_ioc_ctrl_req_s enable_req;
> - struct timeval tv;
>
> bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ,
> bfa_ioc_portid(ioc));
> enable_req.clscode = cpu_to_be16(ioc->clscode);
> - do_gettimeofday(&tv);
> - enable_req.tv_sec = be32_to_cpu(tv.tv_sec);
> + enable_req.tv_sec = be64_to_cpu(ktime_get_real_seconds());
> bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s));
> }
>
> diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h
> index 9ef91f9..aaa68bc 100644
> --- a/drivers/scsi/bfa/bfi.h
> +++ b/drivers/scsi/bfa/bfi.h
> @@ -454,7 +454,7 @@ struct bfi_ioc_ctrl_req_s {
> struct bfi_mhdr_s mh;
> u16 clscode;
> u16 rsvd;
> - u32 tv_sec;
> + u64 tv_sec;
> };
> #define bfi_ioc_enable_req_t struct bfi_ioc_ctrl_req_s;
> #define bfi_ioc_disable_req_t struct bfi_ioc_ctrl_req_s;
Here, you are dealing with firmware data structure, so that gets interpreted
by code running on the SCSI host, and changing the structure layout breaks
the interface.
I would add a comment here that describes how and when the time will still
overflow, and add a cast to (u32). Please also describe this in the
patch description.
You really don't need to list every single change you do in the changelog,
but instead should describe what problems are with the original code and
why your change is done this way.
Arnd
prev parent reply other threads:[~2015-11-03 23:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 13:43 [PATCH] scsi: bfa: Remove struct timeval Amitoj Kaur Chawla
2015-11-03 23:43 ` Arnd Bergmann [this message]
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=5910087.jVgJraTBut@wuerfel \
--to=arnd@arndb.de \
--cc=amitoj1606@gmail.com \
--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.