|
|
9ae3a8 |
From 3e92f885201f2ddf30d093f34a02630ca3324b0b Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Fri, 29 Nov 2013 21:29:17 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 06/37] qemu_memalign: Allow small alignments
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1392117622-28812-7-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 57171
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 06/37] qemu_memalign: Allow small alignments
|
|
|
9ae3a8 |
Bugzilla: 748906
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The functions used by qemu_memalign() require an alignment that is at
|
|
|
9ae3a8 |
least sizeof(void*). Adjust it if it is too small.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
|
|
|
9ae3a8 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: BenoƮt Canet <benoit@irqsave.net>
|
|
|
9ae3a8 |
(cherry picked from commit e5354657a626b325c31888f33de88ac6d39e2fcb)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
util/oslib-posix.c | 5 +++++
|
|
|
9ae3a8 |
1 file changed, 5 insertions(+)
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
util/oslib-posix.c | 5 +++++
|
|
|
9ae3a8 |
1 files changed, 5 insertions(+), 0 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
|
|
|
9ae3a8 |
index 253bc3d..2c756c7 100644
|
|
|
9ae3a8 |
--- a/util/oslib-posix.c
|
|
|
9ae3a8 |
+++ b/util/oslib-posix.c
|
|
|
9ae3a8 |
@@ -85,6 +85,11 @@ void *qemu_oom_check(void *ptr)
|
|
|
9ae3a8 |
void *qemu_memalign(size_t alignment, size_t size)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
void *ptr;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (alignment < sizeof(void*)) {
|
|
|
9ae3a8 |
+ alignment = sizeof(void*);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
ret = posix_memalign(&ptr, alignment, size);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|