Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1153625ybl; Wed, 8 Jan 2020 11:59:41 -0800 (PST) X-Google-Smtp-Source: APXvYqy18VnB0Y91iF4lOWYXWUainkAt0FTvhtSEMnvI+ddfprcSe95qYvhXp/9o69Hlolcez8ex X-Received: by 2002:a05:6830:9a:: with SMTP id a26mr5607932oto.131.1578513581577; Wed, 08 Jan 2020 11:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578513581; cv=none; d=google.com; s=arc-20160816; b=kIBo6B3L9II8WyFw5TyIjDyuilyGbYVYluU1am2FnfD9K//HYd3fhZ+Zh7+34T8EiF c9EjLHzJQY/OCIG4wvELbweIRk0nfzdQZnhJ3CfmoU7vVFyBloTre4TMfZKyRoLqvNVL eUr979vWOvKdKdcP0VdzXym6K+6MWGyNLjuD4G98UKQd1RFVQ3kwHDW8c8llEJd4DDsp UhpOK88w6JBLMBoFSTz8AWpO8ht1gYBmEDjKGKLXlfW3gHVv6GuH7Y+edyVUogZb9F4p PU3akv2IUL1cnPtxmzXEQcg7Ke6oZylolWbIKTcMwc7aBzWsZ1AXS1MFiJYgy2/nvpag xIhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=hMQIx64RKpkskUyJqWHPTo0cO41feakVc2ejH1t/SNU=; b=B0lo0F0i7jI8auXSDE7BUap9jlWpis5ZZj8/6csMZ6W372wlwMkwmMSTXuhZgL60+F g1thTKJByyf6i95Ws+HC3Wm9p4OEGszY7+ctFiR6n4sfEaZqDwT/hm7EEdQkT3FkoRed 9jw1DaJz8piw/R0tcMHkyInalZ9Mzkmdc0BI/uI8dsTBOfC+2UBduMSh+wHiiMnU30U9 coHhbVkG3R4vcfrDJugaL6QYzRF5ASVMyN9R/u0XiA7tj6F0COxZqKBo87LLuAfR7X4z 8RZcAlrtqbpKaS1LGMUnCuCyok1PUwpeFEwS4UBtEV3+wZF20V2AIstowBh8vho3Q+bH qRYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si2340162oih.0.2020.01.08.11.59.28; Wed, 08 Jan 2020 11:59:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730035AbgAHSDG (ORCPT + 99 others); Wed, 8 Jan 2020 13:03:06 -0500 Received: from verein.lst.de ([213.95.11.211]:50572 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727090AbgAHSDG (ORCPT ); Wed, 8 Jan 2020 13:03:06 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 6FC9F68BFE; Wed, 8 Jan 2020 19:03:04 +0100 (CET) Date: Wed, 8 Jan 2020 19:03:04 +0100 From: Christoph Hellwig To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Namjae Jeon , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, gregkh@linuxfoundation.org, valdis.kletnieks@vt.edu, hch@lst.de, sj1557.seo@samsung.com, linkinjeon@gmail.com, Arnd Bergmann Subject: Re: [PATCH v9 09/13] exfat: add misc operations Message-ID: <20200108180304.GE14650@lst.de> References: <20200102082036.29643-1-namjae.jeon@samsung.com> <20200102082036.29643-10-namjae.jeon@samsung.com> <20200102091902.tk374bxohvj33prz@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200102091902.tk374bxohvj33prz@pali> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd, can you review the exfat time handling, especially vs y2038 related issues? On Thu, Jan 02, 2020 at 10:19:02AM +0100, Pali Roh?r wrote: > On Thursday 02 January 2020 16:20:32 Namjae Jeon wrote: > > This adds the implementation of misc operations for exfat. > > > > Signed-off-by: Namjae Jeon > > Signed-off-by: Sungjong Seo > > --- > > fs/exfat/misc.c | 253 ++++++++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 253 insertions(+) > > create mode 100644 fs/exfat/misc.c > > > > diff --git a/fs/exfat/misc.c b/fs/exfat/misc.c > > new file mode 100644 > > index 000000000000..7f533bcb3b3f > > --- /dev/null > > +++ b/fs/exfat/misc.c > > ... > > > +/* externs sys_tz > > + * extern struct timezone sys_tz; > > + */ > > +#define UNIX_SECS_1980 315532800L > > + > > +#if BITS_PER_LONG == 64 > > +#define UNIX_SECS_2108 4354819200L > > +#endif > > ... > > > +#define TIMEZONE_CUR_OFFSET() ((sys_tz.tz_minuteswest / (-15)) & 0x7F) > > +/* Convert linear UNIX date to a FAT time/date pair. */ > > +void exfat_time_unix2fat(struct exfat_sb_info *sbi, struct timespec64 *ts, > > + struct exfat_date_time *tp) > > +{ > > + time_t second = ts->tv_sec; > > + time_t day, month, year; > > + time_t ld; /* leap day */ > > Question for other maintainers: Has kernel code already time_t defined > as 64bit? Or it is still just 32bit and 32bit systems and some time64_t > needs to be used? I remember that there was discussion about these > problems, but do not know if it was changed/fixed or not... Just a > pointer for possible Y2038 problem. As "ts" is of type timespec64, but > "second" of type time_t. > > > + > > + /* Treats as local time with proper time */ > > + second -= sys_tz.tz_minuteswest * SECS_PER_MIN; > > + tp->timezone.valid = 1; > > + tp->timezone.off = TIMEZONE_CUR_OFFSET(); > > + > > + /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ > > + if (second < UNIX_SECS_1980) { > > + tp->second = 0; > > + tp->minute = 0; > > + tp->hour = 0; > > + tp->day = 1; > > + tp->month = 1; > > + tp->year = 0; > > + return; > > + } > > + > > + if (second >= UNIX_SECS_2108) { > > Hello, this code cause compile errors on 32bit systems as UNIX_SECS_2108 > macro is not defined when BITS_PER_LONG == 32. > > Value 4354819200 really cannot fit into 32bit signed integer, so you > should use 64bit signed integer. I would suggest to define this macro > value via LL not just L suffix (and it would work on both 32 and 64bit) > > #define UNIX_SECS_2108 4354819200LL > > > + tp->second = 59; > > + tp->minute = 59; > > + tp->hour = 23; > > + tp->day = 31; > > + tp->month = 12; > > + tp->year = 127; > > + return; > > + } > > -- > Pali Roh?r > pali.rohar@gmail.com ---end quoted text---