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]
Message-ID: <002801d5cce2$228d79f0$67a86dd0$@samsung.com>
Date:   Fri, 17 Jan 2020 11:59:29 +0900
From:   "Namjae Jeon" <namjae.jeon@...sung.com>
To:     "'Arnd Bergmann'" <arnd@...db.de>
Cc:     "'Namjae Jeon'" <linkinjeon@...il.com>,
        <linux-kernel@...r.kernel.org>,
        "'Linux FS-devel Mailing List'" <linux-fsdevel@...r.kernel.org>,
        "'gregkh'" <gregkh@...uxfoundation.org>,
        'Pali Rohár' <pali.rohar@...il.com>,
        "'Valdis Kletnieks'" <valdis.kletnieks@...edu>,
        "'Christoph Hellwig'" <hch@....de>, <sj1557.seo@...sung.com>
Subject: RE: [PATCH v10 09/14] exfat: add misc operations

 
> This is what I think the timezone mount option should be used
> for: if we don't know what the timezone was for the on-disk timestamp, use
> the one provided by the user. However, if none was specified, it should be
> either sys_tz or UTC (i.e. no conversion). I would prefer the use of UTC
> here given the problems with sys_tz, but sys_tz would be more consistent
> with how fs/fat works.
Hi Arnd,

Could you please review this change ?

/* Convert a EXFAT time/date pair to a UNIX date (seconds since 1 1 70). */
void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
                __le16 time, __le16 date, u8 tz)
{       
        u16 t = le16_to_cpu(time);
        u16 d = le16_to_cpu(date);
        
        ts->tv_sec = mktime64(1980 + (d >> 9), d >> 5 & 0x000F, d & 0x001F,
                              t >> 11, (t >> 5) & 0x003F, (t & 0x001F) << 1);
        ts->tv_nsec = 0;
        
        if (tz & EXFAT_TZ_VALID)
                /* Adjust timezone to UTC0. */
                exfat_adjust_tz(ts, tz & ~EXFAT_TZ_VALID);
        else    
                /* Convert from local time to UTC using time_offset. */
                ts->tv_sec -= sbi->options.time_offset * SECS_PER_MIN;
}

/* Convert linear UNIX date to a EXFAT time/date pair. */
void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
                __le16 *time, __le16 *date, u8 *tz)
{
        struct tm tm;
        u16 t, d;

        time64_to_tm(ts->tv_sec, 0, &tm);
        t = (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
        d = ((tm.tm_year - 80) <<  9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday;

        *time = cpu_to_le16(t);
        *date = cpu_to_le16(d);

        /*
         * Record 00h value for OffsetFromUtc field and 1 value for OffsetValid
         * to indicate that local time and UTC are the same.
         */
        *tz = EXFAT_TZ_VALID;
}

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ