lib: sysmem: alloc base and size must be 4-byte aligned

Change-Id: Icf59ee6522f2e0793605b03b0bcf05b58585069f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2019-03-01 10:23:54 +08:00 committed by Jianhong Chen
parent dd20212857
commit 727ebf6de1
1 changed files with 8 additions and 0 deletions

View File

@ -266,6 +266,14 @@ void *sysmem_alloc_align_base(const char *name,
return NULL;
}
if (!IS_ALIGNED(base, 4)) {
SYSMEM_E("\"%s\" base=0x%08lx is not 4-byte aligned\n", name, (ulong)base);
return NULL;
}
/* Must be 4-byte aligned */
size = ALIGN(size, 4);
/* Already allocated ? */
list_for_each(node, &sysmem->allocated_head) {
prop = list_entry(node, struct sysmem_property, node);