summaryrefslogtreecommitdiff
path: root/src/util/virportallocator.c
diff options
context:
space:
mode:
authorPavel Hrdina <phrdina@redhat.com>2018-06-14 09:17:10 +0200
committerPavel Hrdina <phrdina@redhat.com>2018-06-14 09:52:21 +0200
commit5e828d03bf662331579c24677d29e50b9bc33951 (patch)
treea8e6893b2c8e6b1d887e2aa6c4a3691fa6a53067 /src/util/virportallocator.c
parent6bbb35eed8e107803ba3e9fe350d77ac2ed69e74 (diff)
downloadlibvirt-5e828d03bf662331579c24677d29e50b9bc33951.tar.gz
virtportallocator: Change number of ports to 65536
USHRT_MAX is not good enough because the value is 65535 which specifies the number of bits in bitmap. The allowed port range is 0-65535 so we need to increase the number. We could have USHRT_MAX + 1 but let's define the number explicitly. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1590214 Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Diffstat (limited to 'src/util/virportallocator.c')
-rw-r--r--src/util/virportallocator.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c
index 004a2dab81..db95a601c7 100644
--- a/src/util/virportallocator.c
+++ b/src/util/virportallocator.c
@@ -35,6 +35,8 @@
#define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_PORT_ALLOCATOR_NUM_PORTS 65536
+
typedef struct _virPortAllocator virPortAllocator;
typedef virPortAllocator *virPortAllocatorPtr;
struct _virPortAllocator {
@@ -68,7 +70,7 @@ virPortAllocatorNew(void)
if (!(pa = virObjectLockableNew(virPortAllocatorClass)))
return NULL;
- if (!(pa->bitmap = virBitmapNew(USHRT_MAX)))
+ if (!(pa->bitmap = virBitmapNew(VIR_PORT_ALLOCATOR_NUM_PORTS)))
goto error;
return pa;