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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191229140005.qrffmjnmizstjkh4@pali>
Date:   Sun, 29 Dec 2019 15:00:05 +0100
From:   Pali Rohár <pali.rohar@...il.com>
To:     Namjae Jeon <namjae.jeon@...sung.com>
Cc:     linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        gregkh@...uxfoundation.org, valdis.kletnieks@...edu, hch@....de,
        sj1557.seo@...sung.com, linkinjeon@...il.com
Subject: Re: [PATCH v8 09/13] exfat: add misc operations

On Friday 20 December 2019 01:24:15 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 | 240 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 240 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..2fa182cd4ff2
> --- /dev/null
> +++ b/fs/exfat/misc.c

...

> +/* 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 */
> +
> +	if (!sbi->options.tz_utc)
> +		second -= sys_tz.tz_minuteswest * SECS_PER_MIN;
> +
> +	/* 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 (BITS_PER_LONG == 64)
> +	if (second >= UNIX_SECS_2108) {
> +		tp->second  = 59;
> +		tp->minute  = 59;
> +		tp->hour = 23;
> +		tp->day  = 31;
> +		tp->month  = 12;
> +		tp->year = 127;
> +		return;
> +	}
> +#endif

Hello! Why is this code #if-ed? Kernel supports 64 bit long long
integers also for 32 bit platforms.

Function parameter struct timespec64 *ts is already 64 bit. so above
#if-code looks really suspicious.

> +
> +	day = second / SECS_PER_DAY - DAYS_DELTA_DECADE;
> +	year = day / 365;
> +
> +	MAKE_LEAP_YEAR(ld, year);
> +	if (year * 365 + ld > day)
> +		year--;
> +
> +	MAKE_LEAP_YEAR(ld, year);
> +	day -= year * 365 + ld;

-- 
Pali Rohár
pali.rohar@...il.com

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ