[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k51xmi5y.fsf@devron.myhome.or.jp>
Date: Sat, 25 Jul 2009 14:43:37 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Zhaolei <zhaolei@...fujitsu.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Pavel Machek <pavel@....cz>, mingo@...e.hu, tglx@...utronix.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] Use common localtime/gmtime in fat_time_unix2fat()
Zhaolei <zhaolei@...fujitsu.com> writes:
> + if (sbi->options.tz_utc) {
> + gmtime_r(ts->tv_sec, &tm);
> + } else {
> + localtime_r(ts->tv_sec, &tm);
> + }
Missing error check.
> - /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */
> - if (second < UNIX_SECS_1980) {
> + /* FAT can only support year between 1980 to 2107 */
> + if (tm.tm_year < 1980 - 1900) {
> *time = 0;
> *date = cpu_to_le16((0 << 9) | (1 << 5) | 1);
> if (time_cs)
> *time_cs = 0;
> return;
> }
> -#if BITS_PER_LONG == 64
> - if (second >= UNIX_SECS_2108) {
> + if (tm.tm_year > 2107 - 1900) {
> *time = cpu_to_le16((23 << 11) | (59 << 5) | 29);
> *date = cpu_to_le16((127 << 9) | (12 << 5) | 31);
> if (time_cs)
> *time_cs = 199;
> return;
> }
> -#endif
I think tm.tm_year is undefine in case of the error.
Thanks.
--
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists