apparmor: Fix uninitialized symbol 'array_size' in policy_unpack_test.c
authorJohn Johansen <john.johansen@canonical.com>
Tue, 1 Nov 2022 12:40:40 +0000 (05:40 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Wed, 2 Nov 2022 04:23:05 +0000 (21:23 -0700)
Make sure array_size is initialized in the kunit test to get rid of
compiler warnings. This will also make sure the following tests fail
consistently if the first test fails.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_unpack_test.c

index b214f6ea8a725445faca710538508144ef398490..7465da42492d1bfa4447943c398748954945d751 100644 (file)
@@ -140,7 +140,7 @@ static void policy_unpack_test_inbounds_when_out_of_bounds(struct kunit *test)
 static void policy_unpack_test_unpack_array_with_null_name(struct kunit *test)
 {
        struct policy_unpack_fixture *puf = test->priv;
-       u16 array_size;
+       u16 array_size = 0;
 
        puf->e->pos += TEST_ARRAY_BUF_OFFSET;
 
@@ -155,7 +155,7 @@ static void policy_unpack_test_unpack_array_with_name(struct kunit *test)
 {
        struct policy_unpack_fixture *puf = test->priv;
        const char name[] = TEST_ARRAY_NAME;
-       u16 array_size;
+       u16 array_size = 0;
 
        puf->e->pos += TEST_NAMED_ARRAY_BUF_OFFSET;