linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 12600/13311] mm/kfence/kfence_test.c:668:39: sparse: sparse: restricted gfp_t degrades to integer
@ 2020-12-15 22:59 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-12-15 22:59 UTC (permalink / raw)
  To: Marco Elver
  Cc: kbuild-all, Linux Memory Management List, Alexander Potapenko,
	Dmitry Vyukov, Jann Horn, Andrew Morton

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   9317f948b0b188b8d2fded75957e6d42c460df1b
commit: 50ddd24e216f46c656833753a719f85c5d38238f [12600/13311] kfence: add test suite
config: x86_64-randconfig-s022-20201216 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-184-g1b896707-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=50ddd24e216f46c656833753a719f85c5d38238f
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 50ddd24e216f46c656833753a719f85c5d38238f
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

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


"sparse warnings: (new ones prefixed by >>)"
>> mm/kfence/kfence_test.c:668:39: sparse: sparse: restricted gfp_t degrades to integer
>> mm/kfence/kfence_test.c:668:50: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected restricted gfp_t [usertype] @@     got unsigned int @@
   mm/kfence/kfence_test.c:668:50: sparse:     expected restricted gfp_t [usertype]
   mm/kfence/kfence_test.c:668:50: sparse:     got unsigned int

vim +668 mm/kfence/kfence_test.c

   641	
   642	/* Test krealloc(). */
   643	static void test_krealloc(struct kunit *test)
   644	{
   645		const size_t size = 32;
   646		const struct expect_report expect = {
   647			.type = KFENCE_ERROR_UAF,
   648			.fn = test_krealloc,
   649			.addr = test_alloc(test, size, GFP_KERNEL, ALLOCATE_ANY),
   650		};
   651		char *buf = expect.addr;
   652		int i;
   653	
   654		KUNIT_EXPECT_FALSE(test, test_cache);
   655		KUNIT_EXPECT_EQ(test, ksize(buf), size); /* Precise size match after KFENCE alloc. */
   656		for (i = 0; i < size; i++)
   657			buf[i] = i + 1;
   658	
   659		/* Check that we successfully change the size. */
   660		buf = krealloc(buf, size * 3, GFP_KERNEL); /* Grow. */
   661		/* Note: Might no longer be a KFENCE alloc. */
   662		KUNIT_EXPECT_GE(test, ksize(buf), size * 3);
   663		for (i = 0; i < size; i++)
   664			KUNIT_EXPECT_EQ(test, buf[i], (char)(i + 1));
   665		for (; i < size * 3; i++) /* Fill to extra bytes. */
   666			buf[i] = i + 1;
   667	
 > 668		buf = krealloc(buf, size * 2, GFP_KERNEL * 2); /* Shrink. */
   669		KUNIT_EXPECT_GE(test, ksize(buf), size * 2);
   670		for (i = 0; i < size * 2; i++)
   671			KUNIT_EXPECT_EQ(test, buf[i], (char)(i + 1));
   672	
   673		buf = krealloc(buf, 0, GFP_KERNEL); /* Free. */
   674		KUNIT_EXPECT_EQ(test, (unsigned long)buf, (unsigned long)ZERO_SIZE_PTR);
   675		KUNIT_ASSERT_FALSE(test, report_available()); /* No reports yet! */
   676	
   677		READ_ONCE(*expect.addr); /* Ensure krealloc() actually freed earlier KFENCE object. */
   678		KUNIT_ASSERT_TRUE(test, report_matches(&expect));
   679	}
   680	

---
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: 38726 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-15 23:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 22:59 [linux-next:master 12600/13311] mm/kfence/kfence_test.c:668:39: sparse: sparse: restricted gfp_t degrades to integer kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).