lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 8 Jan 2020 20:53:18 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Namjae Jeon <namjae.jeon@...sung.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
        gregkh <gregkh@...uxfoundation.org>,
        Valdis Kletnieks <valdis.kletnieks@...edu>,
        Christoph Hellwig <hch@....de>, linkinjeon@...il.com,
        Markus.Elfring@....de, sj1557.seo@...sung.com
Subject: Re: [PATCH v2 09/13] exfat: add misc operations

On Tue, Nov 19, 2019 at 8:16 AM Namjae Jeon <namjae.jeon@...sung.com> wrote:

> +/* <linux/time.h> externs sys_tz
> + * extern struct timezone sys_tz;
> + */
> +#define UNIX_SECS_1980    315532800L
> +
> +#if BITS_PER_LONG == 64
> +#define UNIX_SECS_2108    4354819200L
> +#endif
> +
> +/* days between 1970/01/01 and 1980/01/01 (2 leap days) */
> +#define DAYS_DELTA_DECADE    (365 * 10 + 2)
> +/* 120 (2100 - 1980) isn't leap year */
> +#define NO_LEAP_YEAR_2100    (120)
> +#define IS_LEAP_YEAR(y)    (!((y) & 0x3) && (y) != NO_LEAP_YEAR_2100)
> +
> +#define SECS_PER_MIN    (60)
> +#define SECS_PER_HOUR   (60 * SECS_PER_MIN)
> +#define SECS_PER_DAY    (24 * SECS_PER_HOUR)

None of this code should exist, just use time64_to_tm() and tm_to_time64()

> +       if (!sbi->options.tz_utc)
> +               ts->tv_sec += sys_tz.tz_minuteswest * SECS_PER_MIN;

I would make tz_utc the default here. Not sure what windows uses or what
the specification says, but sys_tz is a rather unreliable interface, and it's
better to not use that at all if it can be avoided.

It may be useful to have a mount option for the time zone offset instead.

> +       ts->tv_nsec = 0;
> +}
> +
> +/* 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)

This is basically time64_to_tm(), just be careful about to check whether
months are counted from 1 or 0.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ