Skip to content

Commit db81bd6

Browse files
committed
Avoid overflow
1 parent ab1a897 commit db81bd6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tlsf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ INLINE void block_set_prev_free(tlsf_block_t *block, bool free)
130130
INLINE size_t align_up(size_t x, size_t align)
131131
{
132132
ASSERT(!(align & (align - 1)), "must align to a power of two");
133-
return (x + (align - 1)) & ~(align - 1);
133+
return (((x - 1) | (align - 1)) + 1);
134134
}
135135

136136
INLINE char *align_ptr(char *p, size_t align)

0 commit comments

Comments
 (0)