提交 5e828d03 编写于 作者: P Pavel Hrdina

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=1590214Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 6bbb35ee
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define VIR_FROM_THIS VIR_FROM_NONE #define VIR_FROM_THIS VIR_FROM_NONE
#define VIR_PORT_ALLOCATOR_NUM_PORTS 65536
typedef struct _virPortAllocator virPortAllocator; typedef struct _virPortAllocator virPortAllocator;
typedef virPortAllocator *virPortAllocatorPtr; typedef virPortAllocator *virPortAllocatorPtr;
struct _virPortAllocator { struct _virPortAllocator {
...@@ -68,7 +70,7 @@ virPortAllocatorNew(void) ...@@ -68,7 +70,7 @@ virPortAllocatorNew(void)
if (!(pa = virObjectLockableNew(virPortAllocatorClass))) if (!(pa = virObjectLockableNew(virPortAllocatorClass)))
return NULL; return NULL;
if (!(pa->bitmap = virBitmapNew(USHRT_MAX))) if (!(pa->bitmap = virBitmapNew(VIR_PORT_ALLOCATOR_NUM_PORTS)))
goto error; goto error;
return pa; return pa;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册