Message ID | 20220329103919.2376818-1-lv.ruyi@zte.com.cn |
---|---|
State | New |
Headers | show |
Series | kunit: tool: add null pointer check | expand |
diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index 22640c9ee819..be21d0451367 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -71,9 +71,13 @@ kunit_filter_tests(struct kunit_suite *const suite, const char *test_glob) /* Use memcpy to workaround copy->name being const. */ copy = kmalloc(sizeof(*copy), GFP_KERNEL); + if (!copy) + return NULL; memcpy(copy, suite, sizeof(*copy)); filtered = kcalloc(n + 1, sizeof(*filtered), GFP_KERNEL); + if (!filtered) + return NULL; n = 0; kunit_suite_for_each_test_case(suite, test_case) {