[libvirt] [PATCH] virfile: safezero: fix buffer allocation max size
My previous commit 7dc1d4ab was supposed to change safezero to allocate 1 megabyte at maximum, but had the logic reversed and will allocate 1 megabyte at minimum (and a lot more at maximum.) Signed-off-by: Oskari Saarenmaa o...@ohmu.fi --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index f662127..e10de5a 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1075,7 +1075,7 @@ safezero(int fd, off_t offset, off_t len) /* Split up the write in small chunks so as not to allocate lots of RAM */ remain = len; -bytes = MAX(1024 * 1024, len); +bytes = MIN(1024 * 1024, len); r = VIR_ALLOC_N(buf, bytes); if (r 0) { -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virfile: safezero: fix buffer allocation max size
On 04.10.2013 15:49, Oskari Saarenmaa wrote: My previous commit 7dc1d4ab was supposed to change safezero to allocate 1 megabyte at maximum, but had the logic reversed and will allocate 1 megabyte at minimum (and a lot more at maximum.) Signed-off-by: Oskari Saarenmaa o...@ohmu.fi --- src/util/virfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index f662127..e10de5a 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1075,7 +1075,7 @@ safezero(int fd, off_t offset, off_t len) /* Split up the write in small chunks so as not to allocate lots of RAM */ remain = len; -bytes = MAX(1024 * 1024, len); +bytes = MIN(1024 * 1024, len); r = VIR_ALLOC_N(buf, bytes); if (r 0) { Ooops. ACKed and pushed. Meanwhile I'm gonna hide someplace to be alone with shame :) Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list