From patchwork Wed Jan 20 23:54:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/6] rtc-at91sam9: Correct size given to memset Date: Wed, 20 Jan 2010 13:54:26 -0000 From: Alessandro Zummo X-Patchwork-Id: 43382 Message-Id: <20100121005426.32665b23@linux.lan.towertech.it> To: akpm@linux-foundation.org Cc: Julia Lawall , rtc-linux@googlegroups.com From: Julia Lawall Memset should be given the size of the structure, not the size of the pointer. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T *x; expression E; @@ memset(x, E, sizeof( + * x)) // Signed-off-by: Julia Lawall Signed-off-by: Alessandro Zummo patch-name: 6-12-drivers-rtc-Correct-size-given-to-memset.patch patch-rev1: 2016bb275bbeff1778779932b50d77f77f65fb24 patch-rev2: eea6ad3745b7f6f40dd4aec494fcf3d113008d83 --- drivers/rtc/rtc-at91sam9.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 86c61f1..78a018b 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -161,7 +161,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) if (offset == 0) return -EILSEQ; - memset(alrm, 0, sizeof(alrm)); + memset(alrm, 0, sizeof(*alrm)); if (alarm != ALARM_DISABLED && offset != 0) { rtc_time_to_tm(offset + alarm, tm);