Skip to contentSkip to conversation

Blackfin: Fix memset in smp_send_reschedule() and -stop()

PATCH In review Roel Kluin 2 participants 2 messages Nov 21, 2009

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 Blackfin: Fix memset in smp_send_reschedule() and -stop()

To set zeroes the sizeof the struct should be used rather than sizeof the pointer, kzalloc does that.

---
 arch/blackfin/mach-common/smp.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
arch/blackfin/mach-common/smp.c +2 -4
index d98585f..d92b168 100644
@@ -276,10 +276,9 @@ void smp_send_reschedule(int cpu)
 	if (cpu_is_offline(cpu))
 		return;
 
-	msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
+	msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
 	if (!msg)
 		return;
-	memset(msg, 0, sizeof(msg));
 	INIT_LIST_HEAD(&msg->list);
 	msg->type = BFIN_IPI_RESCHEDULE;
 
@@ -305,10 +304,9 @@ void smp_send_stop(void)
 	if (cpus_empty(callmap))
 		return;
 
-	msg = kmalloc(sizeof(*msg), GFP_ATOMIC);
+	msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
 	if (!msg)
 		return;
-	memset(msg, 0, sizeof(msg));
 	INIT_LIST_HEAD(&msg->list);
 	msg->type = BFIN_IPI_CPU_STOP;
 
#1 lore raw
Quoted 2 lines · Roel Kluin

To set zeroes the sizeof the struct should be used rather than sizeof the pointer, kzalloc does that.

thanks, ive merged this
-mike