From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754329AbcAVOch (ORCPT ); Fri, 22 Jan 2016 09:32:37 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:61522 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754267AbcAVOcc (ORCPT ); Fri, 22 Jan 2016 09:32:32 -0500 From: Arnd Bergmann To: David Howells , linux-afs@lists.infradead.org Cc: Al Viro , linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND] AFS: Correctly use 64-bit time for UUID Date: Fri, 22 Jan 2016 15:32:01 +0100 Message-ID: <16523194.QYgGaJTPRn@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:BgXd03Yeregt61GKn7lkA9p6wjOvccDboHuY1Ezjqfu5E+Lz4bi skg1jZTJwIc3fLy5tSJFgNIg49YUVh96yxHECsEC63+ScReJ1y7S4nVqFIomkKmAJs5+v6K f4AGBr4E8PsdvI9JmuVEwfB7yFsf20UK3CrcW/z/u9bYsWo9HzYGhi+AkdlLzlNtqJXfl3f vy1iV9tAZMKg48zcjv9NA== X-UI-Out-Filterresults: notjunk:1;V01:K0:UPGl2u1TfjE=:hqjtUf+QcCac9spB6tSIVn dzLVT555j1c8LxOslbR4H9VYOwU2bpaJznPpknyVdMC5gGtT8fb1UNSGOzOXUMtpZGNhks+CW tG481pcr2JZIFaq6M83YOvVpaNkVcPymU7bWlQpHCcjs15DFHaibqqlU1h+SvxE+AT399V8Fu fUVTk0pXB8sDog1w3srnjMqUMhss/nzh0J8BjnmYO0uG4HCdju5DDsM8fHQimQZVIAmkQ37sl CPj1LiOo2KcQ8GDNn5WG3qF6QZ3bdh5HzC4fPqNP66JR/tsYBsZXmVE2M712dNY3IOajZLCwo c5K8rDkDzlaTaHOAA0klSX8aOWtLXL0yAi/c+j9hLgOpSCIlxyENyfgyYlSWNN9kREWz3C42/ 9Ki4wcQXzZXtZjbUlQNrz+EijO5ohk823E2XVRuLkgyHm9zApiniY8wJ2DRgbFWAB7SskO4mJ WY6kM8GsqAlsihh5Bm31Sl/rrFu2Ta9Iy/Z4tCjBeqhTTE2M4XqZvNeujL/igccrMPm3LD/fz l29laLM2QDgZm19va3rgpUm42X/xSBP3vbSG7cMNR453UyEl9Xu8f47Sc4VVVuy4qpXFHklkv jX60dj7eyhbAW47AnrEP4TueK9ywpdvUCzUrpfRsN14gmHwbU9NtsIxFrVvlihmEy6+VaWMqP KaWJy2DfGDMtN3axekcCrS3S6WDWNcqDMt6fVzo/+h5MqW9LShJGmAWWMP21WmHAmpXwxG2P0 nDYmUr+tLZIWvEDo Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org UUID calculation uses 'struct timespec' whose seconds will overflow in year 2038 and beyond for 32-bit systems. This patch removes the dependency on 'struct timespec' by using ktime_get_real(). While the patch does not fix a 'bug' as such, it is part of a larger effort to remove instances of 'struct timespec' and other data-structures suffering from y2038 problem from the kernel. Suggested-by: Arnd Bergmann Signed-off-by: Tina Ruchandani Signed-off-by: Arnd Bergmann diff --git a/fs/afs/main.c b/fs/afs/main.c index 35de0c04729f..129ff432391c 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "internal.h" MODULE_DESCRIPTION("AFS Client File System"); @@ -37,7 +38,6 @@ struct workqueue_struct *afs_wq; */ static int __init afs_get_client_UUID(void) { - struct timespec ts; u64 uuidtime; u16 clockseq; int ret; @@ -48,9 +48,7 @@ static int __init afs_get_client_UUID(void) if (ret < 0) return ret; - getnstimeofday(&ts); - uuidtime = (u64) ts.tv_sec * 1000 * 1000 * 10; - uuidtime += ts.tv_nsec / 100; + uuidtime = ktime_divns(ktime_get_real(), 100); uuidtime += AFS_UUID_TO_UNIX_TIME; afs_uuid.time_low = uuidtime; afs_uuid.time_mid = uuidtime >> 32;