Patchwork [1/4] rtc: rtc-rs5c372: fixed write buffer size

login
register
mail settings
Submitter thomas.koeller@baslerweb.com
Date June 2, 2010, 1:53 p.m.
Message ID <1275486787-30406-2-git-send-email-thomas.koeller@baslerweb.com>
Download mbox | patch
Permalink /patch/54373/
State New
Headers show

Comments

thomas.koeller@baslerweb.com - June 2, 2010, 1:53 p.m.
From: Thomas Koeller <thomas.koeller@baslerweb.com>

When setting a new time value, the oscillator adjustment register
was overwritten with the contents of an uninitialized memory
byte.

Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
---
 drivers/rtc/rtc-rs5c372.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Wan ZongShun - June 2, 2010, 3:03 p.m.
2010/6/2  <thomas.koeller@baslerweb.com>:
> From: Thomas Koeller <thomas.koeller@baslerweb.com>
>
> When setting a new time value, the oscillator adjustment register
> was overwritten with the contents of an uninitialized memory
> byte.
>

I check this codes of i2c-core.c, the last byte buf[7] sent by this
driver is unuseful.
This patch looks good to me.

Acked-by: Wan ZongShun<mcuos.com@gmail.com>

> Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
> ---
>  drivers/rtc/rtc-rs5c372.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
> index 2f2c68d..211cacd 100644
> --- a/drivers/rtc/rtc-rs5c372.c
> +++ b/drivers/rtc/rtc-rs5c372.c
> @@ -206,7 +206,7 @@ static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
>  static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
>  {
>        struct rs5c372  *rs5c = i2c_get_clientdata(client);
> -       unsigned char   buf[8];
> +       unsigned char   buf[7];
>        int             addr;
>
>        dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d "
> --
> 1.7.1
>
> --
> You received this message because you are subscribed to "rtc-linux".
> Membership options at http://groups.google.com/group/rtc-linux .
> Please read http://groups.google.com/group/rtc-linux/web/checklist
> before submitting a driver.

Patch

diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 2f2c68d..211cacd 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -206,7 +206,7 @@  static int rs5c372_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 static int rs5c372_set_datetime(struct i2c_client *client, struct rtc_time *tm)
 {
 	struct rs5c372	*rs5c = i2c_get_clientdata(client);
-	unsigned char	buf[8];
+	unsigned char	buf[7];
 	int		addr;
 
 	dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d "