All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
Date: Tue, 07 Jul 2020 16:52:21 +0300	[thread overview]
Message-ID: <20200707135221.GY2549@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 7805 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7cc2a8ea104820dd9e702202621e8fd4d9f6c8cf
commit: 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1 apparmor: add AppArmor KUnit tests for policy unpack
date:   6 months ago
config: x86_64-randconfig-m001-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:466 policy_unpack_test_unpack_u32_with_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:499 policy_unpack_test_unpack_u64_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:516 policy_unpack_test_unpack_u64_with_name() error: uninitialized symbol 'data'.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
vim +/data +449 security/apparmor/policy_unpack_test.c

4d944bcd4e731a Mike Salvatore 2019-11-05  438  static void policy_unpack_test_unpack_u32_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  439  {
4d944bcd4e731a Mike Salvatore 2019-11-05  440  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  441  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  442  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  443  
4d944bcd4e731a Mike Salvatore 2019-11-05  444  	puf->e->pos += TEST_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  445  
4d944bcd4e731a Mike Salvatore 2019-11-05  446  	success = unpack_u32(puf->e, &data, NULL);
                                                                             ^^^^^
Presumably not initialized on failure.

4d944bcd4e731a Mike Salvatore 2019-11-05  447  
4d944bcd4e731a Mike Salvatore 2019-11-05  448  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @449  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  450  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  451  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  452  }
4d944bcd4e731a Mike Salvatore 2019-11-05  453  
4d944bcd4e731a Mike Salvatore 2019-11-05  454  static void policy_unpack_test_unpack_u32_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  455  {
4d944bcd4e731a Mike Salvatore 2019-11-05  456  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  457  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  458  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  459  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  460  
4d944bcd4e731a Mike Salvatore 2019-11-05  461  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  462  
4d944bcd4e731a Mike Salvatore 2019-11-05  463  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  464  
4d944bcd4e731a Mike Salvatore 2019-11-05  465  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @466  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  467  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  468  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  469  }
4d944bcd4e731a Mike Salvatore 2019-11-05  470  
4d944bcd4e731a Mike Salvatore 2019-11-05  471  static void policy_unpack_test_unpack_u32_out_of_bounds(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  472  {
4d944bcd4e731a Mike Salvatore 2019-11-05  473  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  474  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  475  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  476  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  477  
4d944bcd4e731a Mike Salvatore 2019-11-05  478  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  479  	puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32);
4d944bcd4e731a Mike Salvatore 2019-11-05  480  
4d944bcd4e731a Mike Salvatore 2019-11-05  481  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  482  
4d944bcd4e731a Mike Salvatore 2019-11-05  483  	KUNIT_EXPECT_FALSE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05  484  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  485  			puf->e->start + TEST_NAMED_U32_BUF_OFFSET);
4d944bcd4e731a Mike Salvatore 2019-11-05  486  }
4d944bcd4e731a Mike Salvatore 2019-11-05  487  
4d944bcd4e731a Mike Salvatore 2019-11-05  488  static void policy_unpack_test_unpack_u64_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  489  {
4d944bcd4e731a Mike Salvatore 2019-11-05  490  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  491  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  492  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  493  
4d944bcd4e731a Mike Salvatore 2019-11-05  494  	puf->e->pos += TEST_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  495  
4d944bcd4e731a Mike Salvatore 2019-11-05  496  	success = unpack_u64(puf->e, &data, NULL);
4d944bcd4e731a Mike Salvatore 2019-11-05  497  
4d944bcd4e731a Mike Salvatore 2019-11-05  498  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @499  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  500  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  501  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  502  }
4d944bcd4e731a Mike Salvatore 2019-11-05  503  
4d944bcd4e731a Mike Salvatore 2019-11-05  504  static void policy_unpack_test_unpack_u64_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  505  {
4d944bcd4e731a Mike Salvatore 2019-11-05  506  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  507  	const char name[] = TEST_U64_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  508  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  509  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  510  
4d944bcd4e731a Mike Salvatore 2019-11-05  511  	puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  512  
4d944bcd4e731a Mike Salvatore 2019-11-05  513  	success = unpack_u64(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  514  
4d944bcd4e731a Mike Salvatore 2019-11-05  515  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @516  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  517  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  518  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  519  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32830 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
Date: Tue, 07 Jul 2020 16:52:21 +0300	[thread overview]
Message-ID: <20200707135221.GY2549@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 7805 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7cc2a8ea104820dd9e702202621e8fd4d9f6c8cf
commit: 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1 apparmor: add AppArmor KUnit tests for policy unpack
date:   6 months ago
config: x86_64-randconfig-m001-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:466 policy_unpack_test_unpack_u32_with_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:499 policy_unpack_test_unpack_u64_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:516 policy_unpack_test_unpack_u64_with_name() error: uninitialized symbol 'data'.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
vim +/data +449 security/apparmor/policy_unpack_test.c

4d944bcd4e731a Mike Salvatore 2019-11-05  438  static void policy_unpack_test_unpack_u32_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  439  {
4d944bcd4e731a Mike Salvatore 2019-11-05  440  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  441  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  442  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  443  
4d944bcd4e731a Mike Salvatore 2019-11-05  444  	puf->e->pos += TEST_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  445  
4d944bcd4e731a Mike Salvatore 2019-11-05  446  	success = unpack_u32(puf->e, &data, NULL);
                                                                             ^^^^^
Presumably not initialized on failure.

4d944bcd4e731a Mike Salvatore 2019-11-05  447  
4d944bcd4e731a Mike Salvatore 2019-11-05  448  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @449  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  450  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  451  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  452  }
4d944bcd4e731a Mike Salvatore 2019-11-05  453  
4d944bcd4e731a Mike Salvatore 2019-11-05  454  static void policy_unpack_test_unpack_u32_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  455  {
4d944bcd4e731a Mike Salvatore 2019-11-05  456  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  457  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  458  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  459  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  460  
4d944bcd4e731a Mike Salvatore 2019-11-05  461  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  462  
4d944bcd4e731a Mike Salvatore 2019-11-05  463  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  464  
4d944bcd4e731a Mike Salvatore 2019-11-05  465  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @466  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  467  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  468  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  469  }
4d944bcd4e731a Mike Salvatore 2019-11-05  470  
4d944bcd4e731a Mike Salvatore 2019-11-05  471  static void policy_unpack_test_unpack_u32_out_of_bounds(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  472  {
4d944bcd4e731a Mike Salvatore 2019-11-05  473  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  474  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  475  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  476  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  477  
4d944bcd4e731a Mike Salvatore 2019-11-05  478  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  479  	puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32);
4d944bcd4e731a Mike Salvatore 2019-11-05  480  
4d944bcd4e731a Mike Salvatore 2019-11-05  481  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  482  
4d944bcd4e731a Mike Salvatore 2019-11-05  483  	KUNIT_EXPECT_FALSE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05  484  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  485  			puf->e->start + TEST_NAMED_U32_BUF_OFFSET);
4d944bcd4e731a Mike Salvatore 2019-11-05  486  }
4d944bcd4e731a Mike Salvatore 2019-11-05  487  
4d944bcd4e731a Mike Salvatore 2019-11-05  488  static void policy_unpack_test_unpack_u64_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  489  {
4d944bcd4e731a Mike Salvatore 2019-11-05  490  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  491  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  492  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  493  
4d944bcd4e731a Mike Salvatore 2019-11-05  494  	puf->e->pos += TEST_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  495  
4d944bcd4e731a Mike Salvatore 2019-11-05  496  	success = unpack_u64(puf->e, &data, NULL);
4d944bcd4e731a Mike Salvatore 2019-11-05  497  
4d944bcd4e731a Mike Salvatore 2019-11-05  498  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @499  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  500  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  501  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  502  }
4d944bcd4e731a Mike Salvatore 2019-11-05  503  
4d944bcd4e731a Mike Salvatore 2019-11-05  504  static void policy_unpack_test_unpack_u64_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  505  {
4d944bcd4e731a Mike Salvatore 2019-11-05  506  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  507  	const char name[] = TEST_U64_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  508  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  509  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  510  
4d944bcd4e731a Mike Salvatore 2019-11-05  511  	puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  512  
4d944bcd4e731a Mike Salvatore 2019-11-05  513  	success = unpack_u64(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  514  
4d944bcd4e731a Mike Salvatore 2019-11-05  515  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @516  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  517  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  518  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  519  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32830 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Mike Salvatore <mike.salvatore@canonical.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>,
	Brendan Higgins <brendanhiggins@google.com>,
	Kees Cook <keescook@chromium.org>
Subject: security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
Date: Tue, 7 Jul 2020 16:52:21 +0300	[thread overview]
Message-ID: <20200707135221.GY2549@kadam> (raw)

[-- Attachment #1: Type: text/plain, Size: 7691 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7cc2a8ea104820dd9e702202621e8fd4d9f6c8cf
commit: 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1 apparmor: add AppArmor KUnit tests for policy unpack
date:   6 months ago
config: x86_64-randconfig-m001-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:466 policy_unpack_test_unpack_u32_with_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:499 policy_unpack_test_unpack_u64_with_null_name() error: uninitialized symbol 'data'.
security/apparmor/policy_unpack_test.c:516 policy_unpack_test_unpack_u64_with_name() error: uninitialized symbol 'data'.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 4d944bcd4e731ab7bfe8d01a7041ea0ebdc090f1
vim +/data +449 security/apparmor/policy_unpack_test.c

4d944bcd4e731a Mike Salvatore 2019-11-05  438  static void policy_unpack_test_unpack_u32_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  439  {
4d944bcd4e731a Mike Salvatore 2019-11-05  440  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  441  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  442  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  443  
4d944bcd4e731a Mike Salvatore 2019-11-05  444  	puf->e->pos += TEST_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  445  
4d944bcd4e731a Mike Salvatore 2019-11-05  446  	success = unpack_u32(puf->e, &data, NULL);
                                                                             ^^^^^
Presumably not initialized on failure.

4d944bcd4e731a Mike Salvatore 2019-11-05  447  
4d944bcd4e731a Mike Salvatore 2019-11-05  448  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @449  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  450  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  451  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  452  }
4d944bcd4e731a Mike Salvatore 2019-11-05  453  
4d944bcd4e731a Mike Salvatore 2019-11-05  454  static void policy_unpack_test_unpack_u32_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  455  {
4d944bcd4e731a Mike Salvatore 2019-11-05  456  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  457  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  458  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  459  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  460  
4d944bcd4e731a Mike Salvatore 2019-11-05  461  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  462  
4d944bcd4e731a Mike Salvatore 2019-11-05  463  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  464  
4d944bcd4e731a Mike Salvatore 2019-11-05  465  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @466  	KUNIT_EXPECT_EQ(test, data, TEST_U32_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  467  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  468  			puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  469  }
4d944bcd4e731a Mike Salvatore 2019-11-05  470  
4d944bcd4e731a Mike Salvatore 2019-11-05  471  static void policy_unpack_test_unpack_u32_out_of_bounds(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  472  {
4d944bcd4e731a Mike Salvatore 2019-11-05  473  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  474  	const char name[] = TEST_U32_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  475  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  476  	u32 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  477  
4d944bcd4e731a Mike Salvatore 2019-11-05  478  	puf->e->pos += TEST_NAMED_U32_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  479  	puf->e->end = puf->e->start + TEST_U32_BUF_OFFSET + sizeof(u32);
4d944bcd4e731a Mike Salvatore 2019-11-05  480  
4d944bcd4e731a Mike Salvatore 2019-11-05  481  	success = unpack_u32(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  482  
4d944bcd4e731a Mike Salvatore 2019-11-05  483  	KUNIT_EXPECT_FALSE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05  484  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  485  			puf->e->start + TEST_NAMED_U32_BUF_OFFSET);
4d944bcd4e731a Mike Salvatore 2019-11-05  486  }
4d944bcd4e731a Mike Salvatore 2019-11-05  487  
4d944bcd4e731a Mike Salvatore 2019-11-05  488  static void policy_unpack_test_unpack_u64_with_null_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  489  {
4d944bcd4e731a Mike Salvatore 2019-11-05  490  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  491  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  492  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  493  
4d944bcd4e731a Mike Salvatore 2019-11-05  494  	puf->e->pos += TEST_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  495  
4d944bcd4e731a Mike Salvatore 2019-11-05  496  	success = unpack_u64(puf->e, &data, NULL);
4d944bcd4e731a Mike Salvatore 2019-11-05  497  
4d944bcd4e731a Mike Salvatore 2019-11-05  498  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @499  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  500  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  501  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  502  }
4d944bcd4e731a Mike Salvatore 2019-11-05  503  
4d944bcd4e731a Mike Salvatore 2019-11-05  504  static void policy_unpack_test_unpack_u64_with_name(struct kunit *test)
4d944bcd4e731a Mike Salvatore 2019-11-05  505  {
4d944bcd4e731a Mike Salvatore 2019-11-05  506  	struct policy_unpack_fixture *puf = test->priv;
4d944bcd4e731a Mike Salvatore 2019-11-05  507  	const char name[] = TEST_U64_NAME;
4d944bcd4e731a Mike Salvatore 2019-11-05  508  	bool success;
4d944bcd4e731a Mike Salvatore 2019-11-05  509  	u64 data;
4d944bcd4e731a Mike Salvatore 2019-11-05  510  
4d944bcd4e731a Mike Salvatore 2019-11-05  511  	puf->e->pos += TEST_NAMED_U64_BUF_OFFSET;
4d944bcd4e731a Mike Salvatore 2019-11-05  512  
4d944bcd4e731a Mike Salvatore 2019-11-05  513  	success = unpack_u64(puf->e, &data, name);
4d944bcd4e731a Mike Salvatore 2019-11-05  514  
4d944bcd4e731a Mike Salvatore 2019-11-05  515  	KUNIT_EXPECT_TRUE(test, success);
4d944bcd4e731a Mike Salvatore 2019-11-05 @516  	KUNIT_EXPECT_EQ(test, data, TEST_U64_DATA);
4d944bcd4e731a Mike Salvatore 2019-11-05  517  	KUNIT_EXPECT_PTR_EQ(test, puf->e->pos,
4d944bcd4e731a Mike Salvatore 2019-11-05  518  			puf->e->start + TEST_U64_BUF_OFFSET + sizeof(u64) + 1);
4d944bcd4e731a Mike Salvatore 2019-11-05  519  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32830 bytes --]

             reply	other threads:[~2020-07-07 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 13:52 Dan Carpenter [this message]
2020-07-07 13:52 ` security/apparmor/policy_unpack_test.c:449 policy_unpack_test_unpack_u32_with_null_name() error: uninitialized symbol 'data' Dan Carpenter
2020-07-07 13:52 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-07-03  4:34 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200707135221.GY2549@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.