Skip to content

Commit c249338

Browse files
keesshuahkh
authored andcommitted
kunit: executor: Remove const from kunit_filter_suites() allocation type
In preparation for making the kmalloc family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "struct kunit_suite **" but the returned type will be "struct kunit_suite * const *". Since it isn't generally possible to remove the const qualifier, adjust the allocation type to match the assignment. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 1d31d53 commit c249338

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/kunit/executor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ kunit_filter_suites(const struct kunit_suite_set *suite_set,
177177

178178
const size_t max = suite_set->end - suite_set->start;
179179

180-
copy = kcalloc(max, sizeof(*filtered.start), GFP_KERNEL);
180+
copy = kcalloc(max, sizeof(*copy), GFP_KERNEL);
181181
if (!copy) { /* won't be able to run anything, return an empty set */
182182
return filtered;
183183
}

0 commit comments

Comments
 (0)