changeset 463:61f2334e1c54

core: fix void * arith
author David Demelier <markand@malikania.fr>
date Mon, 27 Feb 2023 09:55:47 +0100
parents 5729efd23286
children b6b1162dafa3
files libmlk-core/mlk/core/alloc.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmlk-core/mlk/core/alloc.c	Mon Feb 27 09:52:55 2023 +0100
+++ b/libmlk-core/mlk/core/alloc.c	Mon Feb 27 09:55:47 2023 +0100
@@ -108,7 +108,9 @@
 static inline struct block *
 blockat(void *ptr)
 {
-	return ptr - BLKSIZE;
+	unsigned char *addr = (unsigned char *)ptr;
+
+	return (struct block *)&addr[-BLKSIZE];
 }
 
 static inline void *