[RFC,v2,5/6] mem_check(): Correct alignment assumptions

Message ID 20180628025501.20676-6-stewart@linux.ibm.com
State RFC
Headers show
Series
  • Faster fast reboot (2x!)
Related show

Commit Message

Stewart Smith June 28, 2018, 2:55 a.m.
Back in the dim dark past, mem_check() was written to take the
assumption that mem regions need to be sizeof(alloc_hdr) aligned.

I can't see any real reason for this, so change it to sizeof(long)
aligned as we count space by number of longs, so at least that kind of
makes sense.

We hit this assert in a future patch when preserving BOOTKERNEL across
fast reboots.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
---
 core/mem_region.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/core/mem_region.c b/core/mem_region.c
index 571ee52c929c..ce1280b64073 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -548,12 +548,12 @@  bool mem_check(const struct mem_region *region)
 	struct free_hdr *f;
 
 	/* Check it's sanely aligned. */
-	if (region->start % sizeof(struct alloc_hdr)) {
+	if (region->start % sizeof(long)) {
 		prerror("Region '%s' not sanely aligned (%llx)\n",
 			region->name, (unsigned long long)region->start);
 		return false;
 	}
-	if ((long)region->len % sizeof(struct alloc_hdr)) {
+	if ((long)region->len % sizeof(long)) {
 		prerror("Region '%s' not sane length (%llu)\n",
 			region->name, (unsigned long long)region->len);
 		return false;