summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-28 21:27:41 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-09-19 15:09:51 -0400
commitf622bcfe4fd966af4c5ac5deadb4f3e74026078b (patch)
treedcb3a2f98dc0ce26d6478c11a3690b7750a494f2
parentbcaa9465e99051bef52eeb2124b91dacaf2d7ee3 (diff)
downloadrockbox-f622bcfe4fd966af4c5ac5deadb4f3e74026078b.tar.gz
rockbox-f622bcfe4fd966af4c5ac5deadb4f3e74026078b.zip
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
-rw-r--r--firmware/buflib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c
index 4551fd8dca..05e489ea14 100644
--- a/firmware/buflib.c
+++ b/firmware/buflib.c
@@ -144,7 +144,7 @@ bool buflib_context_relocate(struct buflib_context *ctx, void *buf)
144 144
145 /* cannot continue if the buffer is not aligned, since we would need 145 /* cannot continue if the buffer is not aligned, since we would need
146 * to reduce the size of the buffer for aligning */ 146 * to reduce the size of the buffer for aligning */
147 if ((uintptr_t)buf & 0x3) 147 if (!IS_ALIGNED((uintptr_t)buf, sizeof(union buflib_data)))
148 return false; 148 return false;
149 149
150 /* relocate the handle table entries */ 150 /* relocate the handle table entries */