commit | ae8087f3d3a6acc370c7a333cf1d55e4a81d7d89 | [log] [tgz] |
---|---|---|
author | Jens Axboe <axboe@fb.com> | Tue Sep 23 10:59:50 2014 -0600 |
committer | Mohamad Ayyash <mkayyash@google.com> | Fri Mar 06 17:57:15 2015 -0800 |
tree | aaa97bdff5573d356f710bfeb95216f730f8b9d0 | |
parent | 8adb452ea0c7bcaae35d0dadcc273162e75232f2 [diff] |
memalign: fix off-by-one bug in alignment Signed-off-by: Jens Axboe <axboe@fb.com>
diff --git a/memalign.c b/memalign.c index 7a04ffd..cfd6e46 100644 --- a/memalign.c +++ b/memalign.c
@@ -20,7 +20,7 @@ ptr = malloc(size + alignment + size + sizeof(*f) - 1); if (ptr) { - ret = PTR_ALIGN(ptr, alignment); + ret = PTR_ALIGN(ptr, alignment - 1); f = ret + size; f->offset = (uintptr_t) ret - (uintptr_t) ptr; }