My commit af1c98e4 broke the build on RHEL-6:
vircgrouptest.c: In function 'testCgroupGetPercpuStats':
vircgrouptest.c:566: error: nested extern declaration of
'_gl_verify_function2' [-Wnested-externs]

The only thing that needs checking is that the array size
is at least EXPECTED_NCPUS, to prevent access beyond the array.

We can ensure the minimum size also by specifying the array
size upfront.
---
 tests/vircgrouptest.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Pushed as a build fix.

diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
index b65ea3f..a455a81 100644
--- a/tests/vircgrouptest.c
+++ b/tests/vircgrouptest.c
@@ -541,7 +541,7 @@ static int testCgroupGetPercpuStats(const void *args 
ATTRIBUTE_UNUSED)
     virTypedParameterPtr params = NULL;
 # define EXPECTED_NCPUS 160
 
-    unsigned long long expected[] = {
+    unsigned long long expected[EXPECTED_NCPUS] = {
         0, 0, 0, 0, 0, 0, 0, 0,
         7059492996, 0, 0, 0, 0, 0, 0, 0,
         4180532496, 0, 0, 0, 0, 0, 0, 0,
@@ -563,7 +563,6 @@ static int testCgroupGetPercpuStats(const void *args 
ATTRIBUTE_UNUSED)
         5683512916, 0, 0, 0, 0, 0, 0, 0,
         635751356, 0, 0, 0, 0, 0, 0, 0,
     };
-    verify(ARRAY_CARDINALITY(expected) == EXPECTED_NCPUS);
 
     if (VIR_ALLOC_N(params, EXPECTED_NCPUS) < 0)
         goto cleanup;
-- 
2.0.4

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to