From patchwork Wed Jan 28 05:16:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tina Ruchandani X-Patchwork-Id: 5726951 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EA8419F1C5 for ; Wed, 28 Jan 2015 05:16:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1ED79202BE for ; Wed, 28 Jan 2015 05:16:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81B0C20270 for ; Wed, 28 Jan 2015 05:16:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762329AbbA1FQN (ORCPT ); Wed, 28 Jan 2015 00:16:13 -0500 Received: from mail-pa0-f42.google.com ([209.85.220.42]:55292 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762326AbbA1FQL (ORCPT ); Wed, 28 Jan 2015 00:16:11 -0500 Received: by mail-pa0-f42.google.com with SMTP id bj1so23204192pad.1; Tue, 27 Jan 2015 21:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=NAI8fIooRO5je9MszsFfrFe6dyDMuWj8biH39FRyF0g=; b=zHl2JGEnC+u20DPfkZhnVk32ykeCE48rtflpUmfZbY0s1pnXfaV8J8OcEpq0Wz1t4G qFyw2CLytzg/FkS8a967YhY4JUFJHhLrdUpJOAOXmH94Z9SVPFO3Z9v/EGAi9c5bovlN rAH3ItbpiEYmefjRAopB3rZNA1+pgrden/AX0lVgj3S20WJIrfy9YBjgN3KagVB5+Qjn 9UP+QNIKw2Y3MNf4sgwcowq/IjqmVH9ISx/GNLYBEQYMfIEl7iPwOtD4dSyidhpG2M6d 6qb2V1YS8eBth+sIRRfLIF8W4avinJjOllScpTVXlmQi0Y5zGf0/k7M0FDWOKo4Zs9AK x8YQ== X-Received: by 10.68.203.35 with SMTP id kn3mr2834491pbc.78.1422422170929; Tue, 27 Jan 2015 21:16:10 -0800 (PST) Received: from tinar ([117.212.213.203]) by mx.google.com with ESMTPSA id gi3sm3219730pbc.83.2015.01.27.21.16.09 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 21:16:10 -0800 (PST) Date: Wed, 28 Jan 2015 10:46:06 +0530 From: Tina Ruchandani To: linux-fsdevel@vger.kernel.org Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, Alexander Viro Subject: [PATCH v2] coredump: Use 64bit time for unix time of coredump Message-ID: <20150128051606.GA4659@tinar> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Tina Ruchandani Reviewed-by: Arnd Bergmann --- 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(-) -- 2.2.0.rc0.207.ga3a616c -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 #include #include +#include #include #include @@ -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 */