From 4ffcb0208cc9d2d9295ebe846618aca63833fdd8 Mon Sep 17 00:00:00 2001 From: Li Zhang Date: Thu, 7 Nov 2013 16:35:10 +0800 Subject: [PATCH] storage: Fix a vol-clone bug on ppc64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vol-clone reports out of memory error with disk type on ppc64. Currently, wbytes is defined as size_t type (8 bytes), but args's value in ioctl(fd, args..) in kernel is int (4 bytes). This makes wbytes 2^32 times larger, causing an out of memory error. This patch changes size_t to int to synchronize with kernel. [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/block/ioctl.c?id=5e01dc7b#n363 [2] https://lkml.org/lkml/2013/11/1/620 Signed-off-by: Li Zhang Signed-off-by: Ján Tomko --- src/storage/storage_backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 4b1b00db11..1e3292b95f 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -135,7 +135,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol, int amtread = -1; int ret = 0; size_t rbytes = READ_BLOCK_SIZE_DEFAULT; - size_t wbytes = 0; + int wbytes = 0; int interval; char *zerobuf = NULL; char *buf = NULL;