mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kees Cook <kees@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: drivers/misc/lkdtm/bugs.c:492:31: warning: unsequenced accesses to volatile qualified 'element_count'
Date: Sat, 14 Nov 2026 04:47:52 +0100	[thread overview]
Message-ID: <202611140405.wMowxoPE-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   97d73c8251226cf27cc6656b4c542869bb8c69fa
commit: a120a832e3ebca48474d7183ddeadf4138472535 lkdtm/bugs: Add __counted_by_ptr() test PTR_BOUNDS
date:   10 months ago
config: mips-randconfig-2000-20261114 (https://download.01.org/0day-ci/archive/20261114/202611140405.wMowxoPE-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 8621950157210c1fa68f20f0614cb51310ec9dff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261114/202611140405.wMowxoPE-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
| Fixes: a120a832e3eb ("lkdtm/bugs: Add __counted_by_ptr() test PTR_BOUNDS")
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611140405.wMowxoPE-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/misc/lkdtm/bugs.c:492:31: warning: unsequenced accesses to volatile qualified 'element_count' [-Wunsequenced]
     492 |         inst->array[element_count] = element_count;
         |                     ~~~~~~~~~~~~~    ^
   1 warning generated.


vim +/element_count +492 drivers/misc/lkdtm/bugs.c

   475	
   476	static void lkdtm_FAM_BOUNDS(void)
   477	{
   478		struct lkdtm_cb_fam *inst;
   479	
   480		inst = kzalloc(struct_size(inst, array, element_count + 1), GFP_KERNEL);
   481		if (!inst) {
   482			pr_err("FAIL: could not allocate test struct!\n");
   483			return;
   484		}
   485	
   486		inst->count = element_count;
   487		pr_info("Array access within bounds ...\n");
   488		inst->array[1] = element_count;
   489		ignored = inst->array[1];
   490	
   491		pr_info("Array access beyond bounds ...\n");
 > 492		inst->array[element_count] = element_count;
   493		ignored = inst->array[element_count];
   494	
   495		kfree(inst);
   496	
   497		pr_err("FAIL: survived access of invalid flexible array member index!\n");
   498	
   499		if (!IS_ENABLED(CONFIG_CC_HAS_COUNTED_BY))
   500			pr_warn("This is expected since this %s was built with a compiler that does not support __counted_by\n",
   501				lkdtm_kernel_info);
   502		else if (IS_ENABLED(CONFIG_UBSAN_BOUNDS))
   503			pr_expected_config(CONFIG_UBSAN_TRAP);
   504		else
   505			pr_expected_config(CONFIG_UBSAN_BOUNDS);
   506	}
   507	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2026-11-14  3:48 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=202611140405.wMowxoPE-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®