From 1c9fd080dffe5e5ad763527fbc2aa3f6f8c653e9 Mon Sep 17 00:00:00 2001 From: Rae Moar Date: Thu, 3 Aug 2023 19:36:35 +0000 Subject: kunit: fix uninitialized variables bug in attributes filtering Fix smatch warnings regarding uninitialized variables in the filtering patch of the new KUnit Attributes feature. Fixes: 529534e8cba3 ("kunit: Add ability to filter attributes") Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202307270610.s0w4NKEn-lkp@intel.com/ Signed-off-by: Rae Moar Reviewed-by: David Gow Signed-off-by: Shuah Khan --- lib/kunit/executor_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kunit/executor_test.c') diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c index 01280cb8d451..3e0a1c99cb4e 100644 --- a/lib/kunit/executor_test.c +++ b/lib/kunit/executor_test.c @@ -119,7 +119,7 @@ static void parse_filter_attr_test(struct kunit *test) filter_count = kunit_get_filter_count(filters); KUNIT_EXPECT_EQ(test, filter_count, 2); - parsed_filters = kunit_kcalloc(test, filter_count + 1, sizeof(*parsed_filters), + parsed_filters = kunit_kcalloc(test, filter_count, sizeof(*parsed_filters), GFP_KERNEL); for (j = 0; j < filter_count; j++) { parsed_filters[j] = kunit_next_attr_filter(&filters, &err); -- cgit v1.2.3