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:	Thu, 2 Feb 2012 08:53:31 +0530
From:	Venu Byravarasu <vbyravarasu@...dia.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	"rtc-linux@...glegroups.com" <rtc-linux@...glegroups.com>
CC:	Yauhen Kharuzhy <yauhen.kharuzhy@...mwad.com>,
	Alessandro Zummo <a.zummo@...ertech.it>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Ivan Kuten <ivan.kuten@...mwad.com>
Subject: RE: [rtc-linux] [PATCH] RTC: Add driver for NXP PCF8523 RTC chip

> > +/*
> > + * In the routines that deal directly with the pcf8523 hardware, we use
> > + * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.

Do we really need to limit year w.r.t. epoch?
Instead why don't you define a macro for base year in your driver itself?
With this, the same driver may be usable forever, without any modifications 
except for this macro (which also need to change once in a century).
If you use year w.r.t. epoch, this driver definitely need modification before year 2070.

> > + */
> > +static int pcf8523_get_datetime(struct i2c_client *client, struct rtc_time
> *tm)
> > +{
> > +	struct pcf8523 *pcf8523 = i2c_get_clientdata(client);
> > +	unsigned char buf[14] = { PCF8523_REG_CTL1 };
> > +	/* the clock can give out invalid datetime, but we cannot return
> > +	 * -EINVAL otherwise hwclock will refuse to set the time on bootup.
> > +	 */

Somehow I feel to set the RTC to a known time, probably the BASE year, in such
error cases.
> 
> This comment seems to imply that the driver allows hwclock to set the
> time to something which we know is incorrect?  If so, wouldn't it be
> better to leave the time at something obviously wrong, such as 1 Jan
> 1970?
> 
> > +	if (rtc_valid_tm(tm) < 0)
> > +		dev_err(&client->dev, "retrieved date/time is not valid.\n");
> > +
> > +	return 0;
> > +}
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ