rtc-at91sam9: Correct size given to memset
authorJulia Lawall <[email protected]>
Fri, 5 Mar 2010 21:44:23 +0000 (13:44 -0800)
committerLinus Torvalds <[email protected]>
Sat, 6 Mar 2010 19:26:47 +0000 (11:26 -0800)
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/)

// <smpl>
@@
type T;
T *x;
expression E;
@@

memset(x, E, sizeof(
+ *
 x))
// </smpl>

Signed-off-by: Julia Lawall <[email protected]>
Signed-off-by: Alessandro Zummo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/rtc/rtc-at91sam9.c

index 86c61f1435155a2707ea40a90b1889d4a5374ae8..78a018b5c941c5acf51184a46189e9aedbfdff80 100644 (file)
@@ -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);