[libvirt] [PATCH] reject out of range memory in SetMemory APIs

Martin Kletzander mkletzan at redhat.com
Thu May 14 09:23:09 UTC 2015


On Tue, May 05, 2015 at 06:03:32PM +0200, Ján Tomko wrote:
>The APIs take the memory value in KiB and we store it in KiB
>internally, but we cannot parse the whole ULONG_MAX range
>on 64-bit systems, because virDomainParseScaledValue
>needs to fit the value in bytes in an unsigned long long.
>
>https://bugzilla.redhat.com/show_bug.cgi?id=1176739
>---
> src/conf/domain_conf.c   |  7 +------
> src/libvirt-domain.c     | 18 ++++++++++++++++++
> src/libvirt_private.syms |  1 +
> src/util/virutil.c       | 20 ++++++++++++++++++++
> src/util/virutil.h       |  1 +
> 5 files changed, 41 insertions(+), 6 deletions(-)
>
>diff --git a/src/util/virutil.c b/src/util/virutil.c
>index 0426517..e190308 100644
>--- a/src/util/virutil.c
>+++ b/src/util/virutil.c
>@@ -2598,3 +2598,23 @@ virMemoryLimitIsSet(unsigned long long value)
> {
>     return value < VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
> }
>+
>+
>+/**
>+ * virMemoryMaxValue
>+ *
>+ * @ulong: whether the value must fit into unsigned long
>+ *   (unsigned long long is assumed otherwise)

s/unsigned long/long/

ACK with that fixed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150514/3743978c/attachment-0001.sig>


More information about the libvir-list mailing list