Skip to content

Commit fbbc94d

Browse files
svanheuleYuryNorov
authored andcommitted
lib/test_cpumask: fix cpu_possible_mask last test
Since cpumask_first() on the cpu_possible_mask must return at most nr_cpu_ids - 1 for a valid result, cpumask_last() cannot return anything larger than this value. As test_cpumask_weight() also verifies that the total weight of cpu_possible_mask must equal nr_cpu_ids, the last bit set in this mask must be at nr_cpu_ids - 1. Fixes: c41e886 ("lib/test: introduce cpumask KUnit test suite") Link: https://lore.kernel.org/lkml/[email protected]/ Reported-by: Maíra Canal <[email protected]> Signed-off-by: Sander Vanheule <[email protected]> Tested-by: Maíra Canal <[email protected]> Reviewed-by: David Gow <[email protected]> Acked-by: Yury Norov <[email protected]> Signed-off-by: Yury Norov <[email protected]>
1 parent 6afd9db commit fbbc94d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/test_cpumask.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void test_cpumask_first(struct kunit *test)
7373
static void test_cpumask_last(struct kunit *test)
7474
{
7575
KUNIT_EXPECT_LE(test, nr_cpumask_bits, cpumask_last(&mask_empty));
76-
KUNIT_EXPECT_EQ(test, nr_cpumask_bits - 1, cpumask_last(cpu_possible_mask));
76+
KUNIT_EXPECT_EQ(test, nr_cpu_ids - 1, cpumask_last(cpu_possible_mask));
7777
}
7878

7979
static void test_cpumask_next(struct kunit *test)

0 commit comments

Comments
 (0)