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: <CAKYAXd_9XOWtcLYk-+gg636rFCYjLgHzrP5orR3XjXGMpTKWLA@mail.gmail.com>
Date:   Thu, 2 Jan 2020 20:30:03 +0900
From:   Namjae Jeon <linkinjeon@...il.com>
To:     Pali Rohár <pali.rohar@...il.com>
Cc:     Namjae Jeon <namjae.jeon@...sung.com>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        gregkh@...uxfoundation.org, valdis.kletnieks@...edu, hch@....de,
        sj1557.seo@...sung.com
Subject: Re: [PATCH v9 09/13] exfat: add misc operations

2020-01-02 18:19 GMT+09:00, Pali Rohár <pali.rohar@...il.com>:
> 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 <namjae.jeon@...sung.com>
>> Signed-off-by: Sungjong Seo <sj1557.seo@...sung.com>
>> ---
>>  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
>
> ...
>
>> +/* <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
>
> ...
>
>> +#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.
My bad, I will change it with time64_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)
Okay.
>
>   #define UNIX_SECS_2108    4354819200LL
>
>> +		tp->second  = 59;
>> +		tp->minute  = 59;
>> +		tp->hour = 23;
>> +		tp->day  = 31;
>> +		tp->month  = 12;
>> +		tp->year = 127;
>> +		return;
>> +	}
Okay, I will check it.
Thanks for your review!
>
> --
> Pali Rohár
> pali.rohar@...il.com
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ