From: Julia Lawall Date: Fri, 5 Mar 2010 21:44:23 +0000 (-0800) Subject: rtc-at91sam9: Correct size given to memset X-Git-Tag: v2.6.34-rc1~45 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=870a2761a8df7dea7449b4225c9babcf22c6ead4;p=~shefty%2Frdma-dev.git rtc-at91sam9: Correct size given to memset 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 86c61f14351..78a018b5c94 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);