[PATCH 1/1] storage: Fix a vol-clone bug for ppc64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>

vol-clone reports out of memory error with disk type on ppc64.

Currently, wbytes is defined as size_t type which is 8 bytes on ppc64, 
but args's value in ioctl(fd, args..) in kernel is unsigned int. 
So it will read more 4 bytes by ioctl() with size_t from memory which 
gets a large number and causes out of memory error.

This patch changes size_t to unsigned int to synchronize with kernel.

Signed-off-by: Li Zhang <zhlcindy@xxxxxxxxxxxxxxxxxx>
---
 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 4b1b00d..f510080 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;
+    unsigned int wbytes = 0;
     int interval;
     char *zerobuf = NULL;
     char *buf = NULL;
-- 
1.8.2.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]