msm: hotplug/platsmp: Fix cpu invaldation pointer arithmetic
These functions take two void pointers indicating where to start
and end the invalidation and cache flush. The pointer arithmetic
is considering the pen_release pointer as an int pointer so
adding sizeof(pen_release) is adding 16 bytes to the pointer and
specifying that as the end. This inadvertently invalidates data
next to the pen_release variable which could be bad. Fix the
pointer math to only invalidate or clean the region for the
pen_release variable.
Change-Id: If0cf0e5de7c9f4b8c70662b29957a1f347809124
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/hotplug.c b/arch/arm/mach-msm/hotplug.c
index f8324ce..d1d9f4b 100644
--- a/arch/arm/mach-msm/hotplug.c
+++ b/arch/arm/mach-msm/hotplug.c
@@ -54,8 +54,8 @@
* OK, proper wakeup, we're done
*/
pen_release = -1;
- dmac_flush_range((void *)&pen_release,
- (void *)(&pen_release + sizeof(pen_release)));
+ dmac_flush_range((char *)&pen_release,
+ (char *)&pen_release + sizeof(pen_release));
break;
}
@@ -67,8 +67,8 @@
* possible, since we are currently running incoherently, and
* therefore cannot safely call printk() or anything else
*/
- dmac_inv_range((void *)&pen_release,
- (void *)(&pen_release + sizeof(pen_release)));
+ dmac_inv_range((char *)&pen_release,
+ (char *)&pen_release + sizeof(pen_release));
pr_debug("CPU%u: spurious wakeup call\n", cpu);
}
}
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index a11ca95..2749098 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -205,8 +205,8 @@
if (pen_release == -1)
break;
- dmac_inv_range((void *)&pen_release,
- (void *)(&pen_release+sizeof(pen_release)));
+ dmac_inv_range((char *)&pen_release,
+ (char *)&pen_release + sizeof(pen_release));
udelay(10);
}