From: kernel test robot <lkp@intel.com>
To: Marco Elver <elver@google.com>
Cc: kbuild-all@lists.01.org,
Linux Memory Management List <linux-mm@kvack.org>,
Alexander Potapenko <glider@google.com>,
Dmitry Vyukov <dvyukov@google.com>, Jann Horn <jannh@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [linux-next:master 12600/13311] mm/kfence/kfence_test.c:668:39: sparse: sparse: restricted gfp_t degrades to integer
Date: Wed, 16 Dec 2020 06:59:45 +0800 [thread overview]
Message-ID: <202012160641.dAMW8FDx-lkp@intel.com> (raw)
[-- 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 --]
reply other threads:[~2020-12-15 23:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202012160641.dAMW8FDx-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=jannh@google.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox