|
Brian Stinson |
2593d8 |
From 3cf9361996b796eae0bda12aec8c92ddae1d5d48 Mon Sep 17 00:00:00 2001
|
|
Brian Stinson |
2593d8 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Brian Stinson |
2593d8 |
Date: Tue, 4 Jun 2019 09:40:38 +0200
|
|
Brian Stinson |
2593d8 |
Subject: [PATCH] test-cpu-set-util: fix allocation size check on i386
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
We get just 28 bytes not 32 as on 64-bit architectures (__cpu_set_t is 4 bytes,
|
|
Brian Stinson |
2593d8 |
we need at least 26, so 28 satisfies the constraints).
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
(cherry picked from commit 64412970ac0d4b6f5c4bbd8816edc9bff9eab2de)
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
Related: #1734787
|
|
Brian Stinson |
2593d8 |
---
|
|
Brian Stinson |
2593d8 |
src/test/test-cpu-set-util.c | 4 +++-
|
|
Brian Stinson |
2593d8 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
diff --git a/src/test/test-cpu-set-util.c b/src/test/test-cpu-set-util.c
|
|
Brian Stinson |
2593d8 |
index 3456add989..136eaca82d 100644
|
|
Brian Stinson |
2593d8 |
--- a/src/test/test-cpu-set-util.c
|
|
Brian Stinson |
2593d8 |
+++ b/src/test/test-cpu-set-util.c
|
|
Brian Stinson |
2593d8 |
@@ -256,7 +256,9 @@ static void test_cpu_set_to_from_dbus(void) {
|
|
Brian Stinson |
2593d8 |
assert_se(array);
|
|
Brian Stinson |
2593d8 |
assert_se(allocated == c.allocated);
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
- assert(memcmp(array, expected, sizeof expected) == 0);
|
|
Brian Stinson |
2593d8 |
+ assert_se(allocated <= sizeof expected);
|
|
Brian Stinson |
2593d8 |
+ assert_se(allocated >= DIV_ROUND_UP(201u, 8u)); /* We need at least 201 bits for our mask */
|
|
Brian Stinson |
2593d8 |
+ assert(memcmp(array, expected, allocated) == 0);
|
|
Brian Stinson |
2593d8 |
|
|
Brian Stinson |
2593d8 |
assert_se(cpu_set_from_dbus(array, allocated, &c2) == 0);
|
|
Brian Stinson |
2593d8 |
assert_se(c2.set);
|