mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virBitmap: Place virBitmapIsAllClear check after virBitmapParse calls
This patch adds checks for empty bitmaps right after the calls of virBitmapParse. These only include spots where set API's are called and where domain's XML is parsed. Also, it partially reverts commit 983f5a which added a check for invalid nodeset "0,^0" into virBitmapParse function. This change broke the logic, as an empty bitmap should not cause an error. https://bugzilla.redhat.com/show_bug.cgi?id=1210545
This commit is contained in:
@@ -524,16 +524,23 @@ static int
|
||||
test10(const void *opaque ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int ret = -1;
|
||||
virBitmapPtr b1 = NULL, b2 = NULL, b3 = NULL;
|
||||
virBitmapPtr b1 = NULL, b2 = NULL, b3 = NULL, b4 = NULL;
|
||||
|
||||
if (virBitmapParse("0-3,5-8,11-15", 0, &b1, 20) < 0 ||
|
||||
virBitmapParse("4,9,10,16-19", 0, &b2, 20) < 0 ||
|
||||
virBitmapParse("15", 0, &b3, 20) < 0)
|
||||
virBitmapParse("15", 0, &b3, 20) < 0 ||
|
||||
virBitmapParse("0,^0", 0, &b4, 20) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!virBitmapIsAllClear(b4))
|
||||
goto cleanup;
|
||||
|
||||
if (virBitmapOverlaps(b1, b2) ||
|
||||
virBitmapOverlaps(b1, b4) ||
|
||||
virBitmapOverlaps(b2, b3) ||
|
||||
!virBitmapOverlaps(b1, b3))
|
||||
virBitmapOverlaps(b2, b4) ||
|
||||
!virBitmapOverlaps(b1, b3) ||
|
||||
virBitmapOverlaps(b3, b4))
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
Reference in New Issue
Block a user