buflib: fix buflib_context_relocate alignment check

Use the standard IS_ALIGNED macro and check alignment against
sizeof(buflib_data), as it can be greater than 4 bytes if we're
on a 64-bit platform (eg. simulator).

Change-Id: I15110937d1f2978e733d169050de9531fe218214
This commit is contained in:
Aidan MacDonald 2022-03-28 21:27:41 +01:00
parent bcaa9465e9
commit f622bcfe4f

View file

@ -144,7 +144,7 @@ bool buflib_context_relocate(struct buflib_context *ctx, void *buf)
/* cannot continue if the buffer is not aligned, since we would need /* cannot continue if the buffer is not aligned, since we would need
* to reduce the size of the buffer for aligning */ * to reduce the size of the buffer for aligning */
if ((uintptr_t)buf & 0x3) if (!IS_ALIGNED((uintptr_t)buf, sizeof(union buflib_data)))
return false; return false;
/* relocate the handle table entries */ /* relocate the handle table entries */