The millisecond of the last second will be normal if tv_sec is
overflowed. But for y2038 consistency and demonstration purpose,
and avoiding further risks, we still need to fix it here,
to avoid similair problems.
Signed-off-by: Pingbo Wen <pingbo.wen(a)linaro.org>
Cc: Y2038 <y2038(a)lists.linaro.org>
Cc: linux-kernel(a)vger.kernel.org
Cc: Arnd Bergmann <arnd(a)arndb.de>
Cc: Felipe Balbi <balbi(a)ti.com>
---
drivers/usb/gadget/udc/dummy_hcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index 1379ad4..7be721dad 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -833,10 +833,10 @@ static const struct usb_ep_ops dummy_ep_ops = {
/* there are both host and device side versions of this call ... */
static int dummy_g_get_frame(struct usb_gadget *_gadget)
{
- struct timeval tv;
+ struct timespec64 tv;
- do_gettimeofday(&tv);
- return tv.tv_usec / 1000;
+ getnstimeofday64(&tv);
+ return tv.tv_nsec / 1000000L;
}
static int dummy_wakeup(struct usb_gadget *_gadget)
--
1.9.1
Dear customer,
Your payment was successfully processed, your credit card was charged.
Please check your e-ticket in the attachment to this e-mail.
Order details and e-ticket information:
FLIGHT NUMBER : NY626881
DATE & TIME : Sep 19 2015, 10:50
DEPARTING : Indianapolis
TOTAL PRICE : $ 510.00
Thank you for choosing America Airlines.
commit c48f350ff5e7 "bnx2x: Add MFW dump support" added the
bnx2x_update_mfw_dump() function that reads the current time and stores
it in a 32-bit field that gets passed into a buffer in a fixed format.
This is potentially broken when the epoch overflows in 2038, and
otherwise overflows in 2106. As we're trying to avoid uses of
struct timeval for this reason, I noticed the addition of this
function, and tried to rewrite it in a way that is more explicit
about the overflow and that will keep working once we deprecate
struct timeval.
I assume that it is not possible to change the ABI any more, otherwise
we should try to use a 64-bit field for the seconds right away.
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
Cc: Yuval Mintz <Yuval.Mintz(a)qlogic.com>
Cc: Ariel Elior <Ariel.Elior(a)qlogic.com>
---
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index e3da2bddf143..89a174fa1300 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -3705,16 +3705,14 @@ out:
void bnx2x_update_mfw_dump(struct bnx2x *bp)
{
- struct timeval epoc;
u32 drv_ver;
u32 valid_dump;
if (!SHMEM2_HAS(bp, drv_info))
return;
- /* Update Driver load time */
- do_gettimeofday(&epoc);
- SHMEM2_WR(bp, drv_info.epoc, epoc.tv_sec);
+ /* Update Driver load time, possibly broken in y2038 */
+ SHMEM2_WR(bp, drv_info.epoc, (u32)ktime_get_real_seconds());
drv_ver = bnx2x_update_mng_version_utility(DRV_MODULE_VERSION, true);
SHMEM2_WR(bp, drv_info.drv_ver, drv_ver);
Dear Customer,
We could not deliver your item.
Please, open email attachment to print shipment label.
Thanks and best regards,
Troy Fleming,
Sr. Operation Agent.
Dear Customer,
We could not deliver your parcel.
Delivery Label is attached to this email.
Thanks and best regards,
Virgil Russell,
FedEx Support Manager.
Notice to Appear,
You have to appear in the Court on the August 26.
Please, prepare all the documents relating to the case and bring them to Court on the specified date.
Note: The case may be heard by the judge in your absence if you do not come.
The copy of Court Notice is attached to this email.
Regards,
Jamie Conner,
District Clerk.
Dear Customer,
Courier was unable to deliver the parcel to you.
Please, open email attachment to print shipment label.
Thank you for choosing FedEx,
Marc Burch,
Support Manager.
Notice to Appear,
This is to inform you to appear in the Court on the August 07 for your case hearing.
You are kindly asked to prepare and bring the documents relating to the case to Court on the specified date.
Note: The case may be heard by the judge in your absence if you do not come.
The copy of Court Notice is attached to this email.
Yours faithfully,
Lonnie Bloom,
Court Secretary.
This patch series change the 32-bit time types (timespec/itimerspec) to
the 64-bit types (timespec64/itimerspec64), and add new 64bit accessor
functions, which are required in order to avoid y2038 issues in the
posix_clock subsystem.
In order to avoid spamming people too much, I'm only sending the first
few patches of the patch series, and left the other patches for later.
And if you are interested in the whole patch series, see:
https://git.linaro.org/people/baolin.wang/upstream_0627.git
Thoughts and feedback would be appreciated.
Changes since v1:
- Modify the changelog.
- Delete one patch without y2038 safe.
Baolin Wang (5):
time: Introduce struct itimerspec64
timekeeping: Introduce current_kernel_time64()
security: Introduce security_settime64()
time: Introduce do_sys_settimeofday64()
time: Introduce timespec64_to_jiffies()/jiffies_to_timespec64()
include/linux/jiffies.h | 22 +++++++++++++++++++---
include/linux/lsm_hooks.h | 5 +++--
include/linux/security.h | 20 +++++++++++++++++---
include/linux/time64.h | 35 +++++++++++++++++++++++++++++++++++
include/linux/timekeeping.h | 24 +++++++++++++++++++++---
kernel/time/time.c | 28 +++++++++++++++++-----------
kernel/time/timekeeping.c | 6 +++---
security/commoncap.c | 2 +-
security/security.c | 2 +-
9 files changed, 117 insertions(+), 27 deletions(-)
--
1.7.9.5
This is my first attempt to convert sound subsystem to year 2038 safe.
In these series patches I focus on the timer.
When check the time relative code in timer of sound subsystem, I
feel that I could easy split 64bit time_xxx type in kernel and in
userspace (__kernel_time_xxx) according to arnd's approach[1] in
comparison with other parts of sound subsys(e.g. pcm). Whether I
should follow the same approach in the whole sound subsystem is an
open issue for me.
On the other hand, there are difference approaches for dealing with
the code in userspace. It seems that snd_timer_read is the only api
for other parts of alsa. It share the same code no matter tread is
true or false.
The fisrt approach is hide __kernel_time_xxx inside snd_timer_read,
although the code may be a little bit ugly.
The second approach is that force userspace migration to 64bit
time on all 32bit(including compat) system by re-definition the
following types in alsa-lib/include/global.h:
typedef struct __kernel_timespec snd_htimestamp_t;
This approach will not affect the 64bit application.
[1] http://git.kernel.org/cgit/linux/kernel/git/arnd/playground.git/log/?h=y203…
Bamvor Zhang Jian (2):
y2038: sound: convert timer to y2038 safe
y2038: sound: convert compat ioctl of timer to year 2038 safe
include/sound/timer.h | 8 +++++++-
include/uapi/sound/asound.h | 9 ++++++---
sound/core/timer.c | 49 +++++++++++++++++++++++++++++++--------------
sound/core/timer_compat.c | 4 +++-
4 files changed, 50 insertions(+), 20 deletions(-)
--
2.1.4