Message ID | 1386940979-3824-5-git-send-email-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
On 13.12.2013 14:22, Kevin Wolf wrote: > The functions used by qemu_memalign() require an alignment that is at > least sizeof(void*). Adjust it if it is too small. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> > --- > util/oslib-posix.c | 5 +++++ > 1 file changed, 5 insertions(+) Reviewed-by: Max Reitz <mreitz@redhat.com>
diff --git a/util/oslib-posix.c b/util/oslib-posix.c index e00a44c..54f8932 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -85,6 +85,11 @@ void *qemu_oom_check(void *ptr) void *qemu_memalign(size_t alignment, size_t size) { void *ptr; + + if (alignment < sizeof(void*)) { + alignment = sizeof(void*); + } + #if defined(_POSIX_C_SOURCE) && !defined(__sun__) int ret; ret = posix_memalign(&ptr, alignment, size);