All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] coredump: Use 64bit time for unix time of coredump
@ 2015-01-28  5:16 Tina Ruchandani
  2015-01-28 11:31 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Tina Ruchandani @ 2015-01-28  5:16 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Arnd Bergmann, linux-kernel, Alexander Viro

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>
---
Changes in v2:
	- use ktime_get_real_seconds instead of getnstimeofday64
	- fix printf format string:should work on 32-bit systems too.
---
 fs/coredump.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index b5c86ff..d118c1d 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -32,6 +32,7 @@
 #include <linux/pipe_fs_i.h>
 #include <linux/oom.h>
 #include <linux/compat.h>
+#include <linux/timekeeping.h>

 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -225,9 +226,10 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm)
 				break;
 			/* UNIX time of coredump */
 			case 't': {
-				struct timeval tv;
-				do_gettimeofday(&tv);
-				err = cn_printf(cn, "%lu", tv.tv_sec);
+				time64_t time;
+
+				time = ktime_get_real_seconds();
+				err = cn_printf(cn, "%lld", time);
 				break;
 			}
 			/* hostname */
--
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] coredump: Use 64bit time for unix time of coredump
  2015-01-28  5:16 [PATCH v2] coredump: Use 64bit time for unix time of coredump Tina Ruchandani
@ 2015-01-28 11:31 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2015-01-28 11:31 UTC (permalink / raw)
  To: Tina Ruchandani; +Cc: linux-fsdevel, linux-kernel, Alexander Viro

On Wednesday 28 January 2015 10:46:06 Tina Ruchandani wrote:
> 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>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-29  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28  5:16 [PATCH v2] coredump: Use 64bit time for unix time of coredump Tina Ruchandani
2015-01-28 11:31 ` Arnd Bergmann

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.