From: Zbigniew Jędrzejewski-Szmek Date: Tue, 4 Jun 2019 07:40:38 +0000 (+0200) Subject: test-cpu-set-util: fix allocation size check on i386 X-Git-Tag: v243-rc1~318^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12734%2Fhead;p=thirdparty%2Fsystemd.git test-cpu-set-util: fix allocation size check on i386 We get just 28 bytes not 32 as on 64-bit architectures (__cpu_set_t is 4 bytes, we need at least 26, so 28 satisfies the constraints). --- diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c index b04c3148103..e1dd2eb32ba 100644 --- a/src/test/test-cpu-set-util.c +++ b/src/test/test-cpu-set-util.c @@ -254,7 +254,9 @@ static void test_cpu_set_to_from_dbus(void) { assert_se(array); assert_se(allocated == c.allocated); - assert(memcmp(array, expected, sizeof expected) == 0); + assert_se(allocated <= sizeof expected); + assert_se(allocated >= DIV_ROUND_UP(201u, 8u)); /* We need at least 201 bits for our mask */ + assert(memcmp(array, expected, allocated) == 0); assert_se(cpu_set_from_dbus(array, allocated, &c2) == 0); assert_se(c2.set);