From: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: fortify: add KUnit tests for __counted_by and __counted_by_ptr
Date: Wed, 30 Sep 2026 17:56:00 +0200 [thread overview]
Message-ID: <202609301715.SnFPA5YE-lkp@intel.com> (raw)
In-Reply-To: <202609301715.SnFPA5YE-lkp@intel.com>
Hi Bill,
kernel test robot noticed the following build warnings:
url: https://github.com/intel-lab-lkp/linux/commits/Bill-Wendling/fortify-add-KUnit-tests-for-__counted_by-and-__counted_by_ptr/20260929-010031
base:
patch link: https://lore.kernel.org/r/202609301715.SnFPA5YE-lkp%40intel.com
config: x86_64-randconfig-2300-20260930 (https://download.01.org/0day-ci/archive/20260930/202609301715.SnFPA5YE-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260930/202609301715.SnFPA5YE-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609301715.SnFPA5YE-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
lib/tests/fortify_kunit.c:1049:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1049:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
>> lib/tests/fortify_kunit.c:1049:9: sparse: sparse: incompatible types for operation (==):
lib/tests/fortify_kunit.c:1049:9: sparse: unsigned long const __left
lib/tests/fortify_kunit.c:1049:9: sparse: bad type const __right
lib/tests/fortify_kunit.c:1051:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1051:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1051:9: sparse: sparse: incompatible types for operation (==):
lib/tests/fortify_kunit.c:1051:9: sparse: unsigned long const __left
lib/tests/fortify_kunit.c:1051:9: sparse: bad type const __right
lib/tests/fortify_kunit.c:1106:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1106:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1106:9: sparse: sparse: incompatible types for operation (==):
lib/tests/fortify_kunit.c:1106:9: sparse: unsigned long const __left
lib/tests/fortify_kunit.c:1106:9: sparse: bad type const __right
lib/tests/fortify_kunit.c:1107:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1107:9: sparse: sparse: undefined identifier '__builtin_dynamic_object_size'
lib/tests/fortify_kunit.c:1107:9: sparse: sparse: incompatible types for operation (==):
lib/tests/fortify_kunit.c:1107:9: sparse: unsigned long const __left
lib/tests/fortify_kunit.c:1107:9: sparse: bad type const __right
vim +1049 lib/tests/fortify_kunit.c
1036
1037 static void fortify_test_counted_by_flex(struct kunit *test)
1038 {
1039 size_t size = 128;
1040 struct counted_by_flex_struct *s;
1041 size_t elem_bytes = size * sizeof(s->array[0]);
1042
1043 s = alloc_counted_by_flex_struct(test, size);
1044
1045 OPTIMIZER_HIDE_VAR(s);
1046 OPTIMIZER_HIDE_VAR(elem_bytes);
1047
1048 /* __builtin_dynamic_object_size() should return the logical length. */
> 1049 KUNIT_EXPECT_EQ(test, elem_bytes,
1050 __builtin_dynamic_object_size(s->array, 0));
1051 KUNIT_EXPECT_EQ(test, elem_bytes,
1052 __builtin_dynamic_object_size(s->array, 1));
1053
1054 /* Within-bounds write and read succeed. */
1055 memset(s->array, 0x42, elem_bytes);
1056 KUNIT_EXPECT_EQ(test, fortify_write_overflows, 0);
1057 KUNIT_EXPECT_NOT_NULL(test, memchr(s->array, 0x42, elem_bytes));
1058 KUNIT_EXPECT_EQ(test, fortify_read_overflows, 0);
1059
1060 /* Out-of-bounds write and read past logical size are caught. */
1061 memset(s->array, 0x42, elem_bytes + 1);
1062 KUNIT_EXPECT_EQ(test, fortify_write_overflows, 1);
1063 KUNIT_EXPECT_NULL(test, memchr(s->array, 0x42, elem_bytes + 1));
1064 KUNIT_EXPECT_EQ(test, fortify_read_overflows, 1);
1065
1066 kfree(s);
1067 }
1068
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
parent reply other threads:[~2026-09-30 15:56 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <202609301715.SnFPA5YE-lkp@intel.com>]
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=202609301715.SnFPA5YE-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/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.