summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-06-04 09:40:38 +0200
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>2019-12-09 13:13:24 +0100
commit3cf9361996b796eae0bda12aec8c92ddae1d5d48 (patch)
tree7fba1f507eb68d83f802c8229b0364e1a4e1b43b
parentf4344bb4055cab8dc3bbe82a7f3d97fc6fabcb7e (diff)
downloadsystemd-3cf9361996b796eae0bda12aec8c92ddae1d5d48.tar.gz
test-cpu-set-util: fix allocation size check on i386v239-22v239-21
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). (cherry picked from commit 64412970ac0d4b6f5c4bbd8816edc9bff9eab2de) Related: #1734787
-rw-r--r--src/test/test-cpu-set-util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c
index 3456add989..136eaca82d 100644
--- a/src/test/test-cpu-set-util.c
+++ b/src/test/test-cpu-set-util.c
@@ -256,7 +256,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);