Fix non aligned crashes with tlsf
When the starting address of the plugin buffer
is not aligned to 8 bytes crashes occur in tlsf
(on ARM atleast)
Change-Id: I655500c25e1c8f84b4a2418e9ec5c5948e4bea82
diff --git a/apps/plugin.c b/apps/plugin.c
index 41434f2..3c957b4 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -921,7 +921,8 @@
return -1;
}
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
- plugin_size = hdr->end_addr - pluginbuf;
+ /* tlsf crashes observed on arm with 0x4 aligned addresses */
+ plugin_size = ALIGN_UP(hdr->end_addr - pluginbuf, 0x8);
#else
plugin_size = 0;
#endif
diff --git a/lib/tlsf/src/tlsf.c b/lib/tlsf/src/tlsf.c
index b842be4..cea53c3 100644
--- a/lib/tlsf/src/tlsf.c
+++ b/lib/tlsf/src/tlsf.c
@@ -508,7 +508,8 @@
/* FW 28-10-17: disabled memset due to crashes on ARM. Functions
* fine without it. */
- /* memset(area, 0, area_size); */
+ /* BILGUS 17-7-19 re-enabled after setting pluginbuf aligned to 8 bytes */
+ memset(area, 0, area_size);
ptr = tlsf->area_head;
ptr_prev = 0;