diff options
author | Arnd Bergmann <arnd@arndb.de> | 2015-11-25 10:22:25 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-12-06 21:17:17 -0500 |
commit | 03927c8acb63100046260711c06ba28b6b5936fb (patch) | |
tree | a9d112dd05a9baeb26500dcb085be2ed313b2d5c /fs/coredump.c | |
parent | 0125f504ed320826a78b43d636de957d703465a8 (diff) |
coredump: Use 64bit time for unix time of coredump
struct timeval on 32-bit systems will have its tv_sec
value overflow in year 2038 and beyond.
Use a 64 bit value to print time of the coredump in seconds.
ktime_get_real_seconds is chosen here for efficiency reasons.
Suggested by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coredump.c')
-rw-r--r-- | fs/coredump.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/coredump.c b/fs/coredump.c index 1777331eee76..b3c153ca435d 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/pipe_fs_i.h> | 32 | #include <linux/pipe_fs_i.h> |
33 | #include <linux/oom.h> | 33 | #include <linux/oom.h> |
34 | #include <linux/compat.h> | 34 | #include <linux/compat.h> |
35 | #include <linux/timekeeping.h> | ||
35 | 36 | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/mmu_context.h> | 38 | #include <asm/mmu_context.h> |
@@ -232,9 +233,10 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm) | |||
232 | break; | 233 | break; |
233 | /* UNIX time of coredump */ | 234 | /* UNIX time of coredump */ |
234 | case 't': { | 235 | case 't': { |
235 | struct timeval tv; | 236 | time64_t time; |
236 | do_gettimeofday(&tv); | 237 | |
237 | err = cn_printf(cn, "%lu", tv.tv_sec); | 238 | time = ktime_get_real_seconds(); |
239 | err = cn_printf(cn, "%lld", time); | ||
238 | break; | 240 | break; |
239 | } | 241 | } |
240 | /* hostname */ | 242 | /* hostname */ |